• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the 'License');
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an 'AS IS' BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16var __decorate = (this && this.__decorate) || function (z34, a35, b35, c35) {
17    var d35 = arguments.length,
18        e35 = d35 < 3 ? a35 : c35 === null ? c35 = Object.getOwnPropertyDescriptor(a35, b35) : c35, f35;
19    if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') {
20        e35 = Reflect.decorate(z34, a35, b35, c35);
21    } else {
22        for (var g35 = z34.length - 1; g35 >= 0; g35--) {
23            if (f35 = z34[g35]) {
24                e35 = (d35 < 3 ? f35(e35) : d35 > 3 ? f35(a35, b35, e35) : f35(a35, b35)) || e35;
25            }
26        }
27    }
28    return d35 > 3 && e35 && Object.defineProperty(a35, b35, e35), e35;
29};
30if (!('finalizeConstruction' in ViewPU.prototype)) {
31    Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => {
32    });
33}
34
35const hilog = requireNapi('hilog');
36const LengthMetrics = requireNapi('arkui.node').LengthMetrics;
37const resourceManager = requireNapi('resourceManager');
38const accessibility = requireNapi('accessibility');
39const BusinessError = requireNapi('BusinessError');
40
41const IMAGE_NODE_HEIGHT = 24;
42const IMAGE_NODE_WIDTH = 24;
43const ITEM_WIDTH = 0;
44const ITEM_HEIGHT = 48;
45const ITEM_HEIGHT_INPUT = 32;
46const BORDER_WIDTH_HAS = 2;
47const BORDER_WIDTH_NONE = 0;
48const NODE_HEIGHT = 48;
49const LIST_ITEM_HEIGHT_NONE = 0;
50const LIST_ITEM_HEIGHT = 48;
51const SHADOW_OFFSETY = 10;
52const FLAG_NUMBER = 2;
53const DRAG_OPACITY = 0.4;
54const DRAG_OPACITY_NONE = 1;
55const MIN_FONT_SCALE = 1;
56const MAX_FONT_SCALE = 2;
57const FLAG_LINE_HEIGHT = '1.0vp';
58const X_OFF_SET = '0vp';
59const Y_OFF_SET = '2.75vp';
60const Y_BOTTOM_OFF_SET = '-1.25vp';
61const Y_BASE_PLATE_OFF_SET = '1.5vp';
62const COLOR_IMAGE_EDIT = '#FFFFFF';
63const COLOR_IMAGE_ROW = '#00000000';
64const COLOR_SELECT = '#1A0A59F7';
65const SHADOW_COLOR = '#00001E';
66const GRAG_POP_UP_HEIGHT = '48';
67const FLOOR_MIN_WIDTH = '128vp';
68const FLOOR_MAX_WIDTH = '208vp';
69const TEXT_MIN_WIDTH = '80vp';
70const TEXT_MAX_WIDTH = '160vp';
71const MIN_WIDTH = '112vp';
72const MAX_WIDTH = '192vp';
73const TRANS_COLOR = '#00FFFFFF';
74const DELAY_TIME = 100;
75const LEVEL_MARGIN = 12;
76const MARGIN_OFFSET = 8;
77const TAG = 'TreeView';
78const LOG_CODE = 0x3900;
79const ENTER_EXIT_DURATION = 2000;
80const ACCESSIBILITY_REFOCUS_DELAY_TIME = 300;
81const RESOURCE_TYPE_SYMBOL = 40000;
82const MAX_SYMBOL_FONT_SCALE = 1.3;
83const MIN_SYMBOL_FONT_SCALE = 1;
84const ARROW_DOWN = {
85    'id': -1,
86    'type': 40000,
87    params: ['sys.symbol.chevron_down'],
88    'bundleName': '__harDefaultBundleName__',
89    'moduleName': '__harDefaultModuleName__',
90};
91const ARROW_DOWN_WITHE = {
92    'id': -1,
93    'type': 40000,
94    params: ['sys.symbol.chevron_down'],
95    'bundleName': '__harDefaultBundleName__',
96    'moduleName': '__harDefaultModuleName__',
97};
98const ARROW_RIGHT = {
99    'id': -1,
100    'type': 40000,
101    params: ['sys.symbol.chevron_right'],
102    'bundleName': '__harDefaultBundleName__',
103    'moduleName': '__harDefaultModuleName__',
104};
105const ARROW_RIGHT_WITHE = {
106    'id': -1,
107    'type': 40000,
108    params: ['sys.symbol.chevron_right'],
109    'bundleName': '__harDefaultBundleName__',
110    'moduleName': '__harDefaultModuleName__',
111};
112var Event;
113(function (x34) {
114    x34[x34['TOUCH_DOWN'] = 0] = 'TOUCH_DOWN';
115    x34[x34['TOUCH_UP'] = 1] = 'TOUCH_UP';
116    x34[x34['HOVER'] = 3] = 'HOVER';
117    x34[x34['HOVER_OVER'] = 4] = 'HOVER_OVER';
118    x34[x34['FOCUS'] = 5] = 'FOCUS';
119    x34[x34['BLUR'] = 6] = 'BLUR';
120    x34[x34['MOUSE_BUTTON_RIGHT'] = 7] = 'MOUSE_BUTTON_RIGHT';
121    x34[x34['DRAG'] = 8] = 'DRAG';
122})(Event || (Event = {}));
123var MenuOperation;
124(function (w34) {
125    w34[w34['ADD_NODE'] = 0] = 'ADD_NODE';
126    w34[w34['REMOVE_NODE'] = 1] = 'REMOVE_NODE';
127    w34[w34['MODIFY_NODE'] = 2] = 'MODIFY_NODE';
128    w34[w34['COMMIT_NODE'] = 3] = 'COMMIT_NODE';
129})(MenuOperation || (MenuOperation = {}));
130var PopUpType;
131(function (v34) {
132    v34[v34['HINTS'] = 0] = 'HINTS';
133    v34[v34['WARNINGS'] = 1] = 'WARNINGS';
134})(PopUpType || (PopUpType = {}));
135var InputError;
136(function (u34) {
137    u34[u34['INVALID_ERROR'] = 0] = 'INVALID_ERROR';
138    u34[u34['LENGTH_ERROR'] = 1] = 'LENGTH_ERROR';
139    u34[u34['NONE'] = 2] = 'NONE';
140})(InputError || (InputError = {}));
141var Flag;
142(function (t34) {
143    t34[t34['DOWN_FLAG'] = 0] = 'DOWN_FLAG';
144    t34[t34['UP_FLAG'] = 1] = 'UP_FLAG';
145    t34[t34['NONE'] = 2] = 'NONE';
146})(Flag || (Flag = {}));
147
148export var NodeStatus;
149(function (s34) {
150    s34[s34['EXPAND'] = 0] = 'EXPAND';
151    s34[s34['COLLAPSE'] = 1] = 'COLLAPSE';
152})(NodeStatus || (NodeStatus = {}));
153
154export var InteractionStatus;
155(function (r34) {
156    r34[r34['NORMAL'] = 0] = 'NORMAL';
157    r34[r34['SELECTED'] = 1] = 'SELECTED';
158    r34[r34['EDIT'] = 2] = 'EDIT';
159    r34[r34['FINISH_EDIT'] = 3] = 'FINISH_EDIT';
160    r34[r34['DRAG_INSERT'] = 4] = 'DRAG_INSERT';
161    r34[r34['FINISH_DRAG_INSERT'] = 5] = 'FINISH_DRAG_INSERT';
162})(InteractionStatus || (InteractionStatus = {}));
163var CollapseImageType;
164(function (q34) {
165    q34[q34['ARROW_DOWN'] = 0] = 'ARROW_DOWN';
166    q34[q34['ARROW_RIGHT'] = 1] = 'ARROW_RIGHT';
167    q34[q34['ARROW_DOWN_WHITE'] = 2] = 'ARROW_DOWN_WHITE';
168    q34[q34['ARROW_RIGHT_WHITE'] = 3] = 'ARROW_RIGHT_WHITE';
169})(CollapseImageType || (CollapseImageType = {}));
170var AccessibilityNodeType;
171(function (p34) {
172    p34[p34['TEXT'] = 0] = 'TEXT';
173    p34[p34['PLACE'] = 1] = 'PLACE';
174    p34[p34['LIFT'] = 2] = 'LIFT';
175})(AccessibilityNodeType || (AccessibilityNodeType = {}));
176
177class Util {
178    static isSymbolResource(n34) {
179        if (!Util.isResourceType(n34)) {
180            return false;
181        }
182        let o34 = n34;
183        return o34.type === RESOURCE_TYPE_SYMBOL;
184    }
185
186    static isResourceType(m34) {
187        if (!m34) {
188            return false;
189        }
190        if (typeof m34 === 'string' || typeof m34 === 'undefined') {
191            return false;
192        }
193        return true;
194    }
195}
196
197class TreeViewNodeItemFactory {
198    constructor() {
199    }
200
201    static getInstance() {
202        if (!TreeViewNodeItemFactory.instance) {
203            TreeViewNodeItemFactory.instance = new TreeViewNodeItemFactory();
204        }
205        return TreeViewNodeItemFactory.instance;
206    }
207
208    createNode() {
209        return {
210            imageNode: undefined,
211            inputText: new InputText(),
212            mainTitleNode: new MainTitleNode(''),
213            imageCollapse: undefined,
214            fontColor: undefined,
215        };
216    }
217
218    createNodeByNodeParam(k34) {
219        let l34 = this.createNode();
220        if (k34.icon) {
221            l34.imageNode = new ImageNode(k34.icon, k34.symbolIconStyle, {
222                'id': -1,
223                'type': 10002,
224                params: ['sys.float.ohos_id_alpha_content_fourth'],
225                'bundleName': '__harDefaultBundleName__',
226                'moduleName': '__harDefaultModuleName__',
227            }, IMAGE_NODE_HEIGHT, IMAGE_NODE_WIDTH, k34.selectedIcon, k34.symbolSelectedIconStyle, k34.editIcon,
228                k34.symbolEditIconStyle);
229        }
230        if (k34.primaryTitle) {
231            l34.mainTitleNode = new MainTitleNode(k34.primaryTitle);
232        }
233        return l34;
234    }
235}
236
237let emptyNodeInfo = {
238    isFolder: true,
239    icon: '',
240    symbolIconStyle: undefined,
241    selectedIcon: '',
242    symbolSelectedIconStyle: undefined,
243    editIcon: '',
244    symbolEditIconStyle: undefined,
245    container: () => {
246    },
247    secondaryTitle: '',
248    primaryTitle: '',
249    parentNodeId: -1,
250    currentNodeId: -1,
251};
252
253class TreeViewTheme {
254    constructor() {
255        this.itemSelectedBgColor = '#1A0A59F7';
256        this.primaryTitleFontColor = {
257            'id': -1,
258            'type': 10001,
259            params: ['sys.color.ohos_id_color_primary'],
260            'bundleName': '__harDefaultBundleName__',
261            'moduleName': '__harDefaultModuleName__',
262        };
263        this.secondaryTitleFontColor = {
264            'id': -1,
265            'type': 10001,
266            params: ['sys.color.ohos_id_color_secondary'],
267            'bundleName': '__harDefaultBundleName__',
268            'moduleName': '__harDefaultModuleName__',
269        };
270        this.primaryTitleActiveFontColor = {
271            'id': -1,
272            'type': 10001,
273            params: ['sys.color.ohos_id_color_text_primary_activated'],
274            'bundleName': '__harDefaultBundleName__',
275            'moduleName': '__harDefaultModuleName__',
276        };
277        this.itemPressedBgColor = {
278            'id': -1,
279            'type': 10001,
280            params: ['sys.color.ohos_id_color_click_effect'],
281            'bundleName': '__harDefaultBundleName__',
282            'moduleName': '__harDefaultModuleName__',
283        };
284        this.itemHoverBgColor = {
285            'id': -1,
286            'type': 10001,
287            params: ['sys.color.ohos_id_color_hover'],
288            'bundleName': '__harDefaultBundleName__',
289            'moduleName': '__harDefaultModuleName__',
290        };
291        this.borderFocusedColor = {
292            'id': -1,
293            'type': 10001,
294            params: ['sys.color.ohos_id_color_focused_outline'],
295            'bundleName': '__harDefaultBundleName__',
296            'moduleName': '__harDefaultModuleName__',
297        };
298        this.leftIconColor = {
299            'id': -1,
300            'type': 10001,
301            params: ['sys.color.icon_secondary'],
302            'bundleName': '__harDefaultBundleName__',
303            'moduleName': '__harDefaultModuleName__',
304        };
305        this.leftIconActiveColor = {
306            'id': -1,
307            'type': 10001,
308            params: ['sys.color.icon_secondary'],
309            'bundleName': '__harDefaultBundleName__',
310            'moduleName': '__harDefaultModuleName__',
311        };
312        this.arrowIconColor = {
313            'id': -1,
314            'type': 10001,
315            params: ['sys.color.icon_tertiary'],
316            'bundleName': '__harDefaultBundleName__',
317            'moduleName': '__harDefaultModuleName__',
318        };
319    }
320
321    static getInstance() {
322        if (!TreeViewTheme.instance) {
323            TreeViewTheme.instance = new TreeViewTheme();
324        }
325        return TreeViewTheme.instance;
326    }
327}
328
329let NodeInfo = class NodeInfo {
330    constructor(i34, j34) {
331        this.imageSource = '';
332        this.symbolSource = undefined;
333        this.borderWidth = { has: BORDER_WIDTH_HAS, none: BORDER_WIDTH_NONE };
334        this.canShowFlagLine = false;
335        this.isOverBorder = false;
336        this.canShowBottomFlagLine = false;
337        this.isHighLight = false;
338        this.isModify = false;
339        this.treeViewTheme = TreeViewTheme.getInstance();
340        this.fontColor = '';
341        this.node = i34;
342        this.nodeParam = j34;
343        this.nodeItemView = TreeViewNodeItemFactory.getInstance().createNodeByNodeParam(j34);
344        this.popUpInfo = {
345            popUpIsShow: false,
346            popUpEnableArrow: false,
347            popUpColor: undefined,
348            popUpText: '',
349            popUpTextColor: undefined,
350        };
351        this.nodeHeight = NODE_HEIGHT;
352        this.nodeLeftPadding = i34.nodeLevel * LEVEL_MARGIN + MARGIN_OFFSET;
353        this.nodeColor = {
354            'id': -1,
355            'type': 10001,
356            params: ['sys.color.ohos_id_color_background'],
357            'bundleName': '__harDefaultBundleName__',
358            'moduleName': '__harDefaultModuleName__',
359        };
360        this.nodeIsShow = (this.node.nodeLevel > 0) ? false : true;
361        this.listItemHeight = (this.node.nodeLevel > 0) ? LIST_ITEM_HEIGHT_NONE : LIST_ITEM_HEIGHT;
362        this.isShowTitle = true;
363        this.isShowInputText = false;
364        this.isSelected = false;
365        this.status = {
366            normal: {
367                'id': -1,
368                'type': 10001,
369                params: ['sys.color.ohos_id_color_background_transparent'],
370                'bundleName': '__harDefaultBundleName__',
371                'moduleName': '__harDefaultModuleName__',
372            },
373            hover: this.treeViewTheme.itemHoverBgColor,
374            press: this.treeViewTheme.itemPressedBgColor,
375            selected: this.treeViewTheme.itemSelectedBgColor,
376            highLight: {
377                'id': -1,
378                'type': 10001,
379                params: ['sys.color.ohos_id_color_activated'],
380                'bundleName': '__harDefaultBundleName__',
381                'moduleName': '__harDefaultModuleName__',
382            }
383        };
384        this.nodeBorder = {
385            borderWidth: BORDER_WIDTH_NONE,
386            borderColor: this.treeViewTheme.borderFocusedColor,
387            borderRadius: {
388                'id': -1,
389                'type': 10002,
390                params: ['sys.float.ohos_id_corner_radius_clicked'],
391                'bundleName': '__harDefaultBundleName__',
392                'moduleName': '__harDefaultModuleName__',
393            }
394        };
395        this.flagLineLeftMargin = i34.nodeLevel * LEVEL_MARGIN + MARGIN_OFFSET;
396    }
397
398    addImageCollapse(h34) {
399        if (h34) {
400            this.nodeItemView.imageCollapse =
401                CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_RIGHT);
402        } else {
403            this.nodeItemView.imageCollapse = undefined;
404        }
405    }
406
407    addImageExpand(a2) {
408        if (a2) {
409            this.nodeItemView.imageCollapse =
410                CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_DOWN);
411        } else {
412            this.nodeItemView.imageCollapse = undefined;
413        }
414    }
415
416    setFontColor(g34) {
417        this.fontColor = g34;
418    }
419
420    getFontColor() {
421        return this.fontColor;
422    }
423
424    getPopUpInfo() {
425        return this.popUpInfo;
426    }
427
428    setPopUpIsShow(f34) {
429        this.popUpInfo.popUpIsShow = f34;
430    }
431
432    setPopUpEnableArrow(e34) {
433        this.popUpInfo.popUpEnableArrow = e34;
434    }
435
436    setPopUpColor(d34) {
437        this.popUpInfo.popUpColor = d34;
438    }
439
440    setPopUpText(c34) {
441        this.popUpInfo.popUpText = c34;
442    }
443
444    setPopUpTextColor(b34) {
445        this.popUpInfo.popUpTextColor = b34;
446    }
447
448    getIsShowTitle() {
449        return this.isShowTitle;
450    }
451
452    getIsShowInputText() {
453        return this.isShowInputText;
454    }
455
456    setTitleAndInputTextStatus(a34) {
457        if (a34) {
458            this.isShowTitle = false;
459            this.isShowInputText = true;
460        } else {
461            this.isShowTitle = true;
462            this.isShowInputText = false;
463        }
464    }
465
466    handleImageCollapseAfterAddNode(z33) {
467        if (z33) {
468            this.nodeItemView.imageCollapse =
469                CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_DOWN);
470        } else {
471            this.nodeItemView.imageCollapse = undefined;
472        }
473    }
474
475    setNodeColor(y33) {
476        if (y33 === undefined) {
477            return;
478        }
479        this.nodeColor = y33;
480    }
481
482    getNodeColor() {
483        return this.nodeColor;
484    }
485
486    setListItemHeight(x33) {
487        this.listItemHeight = x33;
488    }
489
490    getListItemHeight() {
491        return this.listItemHeight;
492    }
493
494    getNodeCurrentNodeId() {
495        return this.node.currentNodeId;
496    }
497
498    getNodeParentNodeId() {
499        return this.node.parentNodeId;
500    }
501
502    getNodeLeftPadding() {
503        return this.nodeLeftPadding;
504    }
505
506    getNodeHeight() {
507        return this.nodeHeight;
508    }
509
510    setNodeIsShow(w33) {
511        this.nodeIsShow = w33;
512    }
513
514    getNodeIsShow() {
515        return this.nodeIsShow;
516    }
517
518    getNodeItem() {
519        return this.nodeItemView;
520    }
521
522    getNodeStatus() {
523        return this.status;
524    }
525
526    getNodeBorder() {
527        return this.nodeBorder;
528    }
529
530    setNodeBorder(v33) {
531        this.nodeBorder.borderWidth = v33 ? this.borderWidth.has : this.borderWidth.none;
532    }
533
534    getChildNodeInfo() {
535        return this.node.childNodeInfo;
536    }
537
538    getMenu() {
539        return this.nodeParam.container;
540    }
541
542    setIsSelected(u33) {
543        this.isSelected = u33;
544    }
545
546    getIsSelected() {
547        return this.isSelected;
548    }
549
550    getNodeInfoData() {
551        return this.nodeParam;
552    }
553
554    getNodeInfoNode() {
555        return this.node;
556    }
557
558    getIsFolder() {
559        return this.nodeParam.isFolder;
560    }
561
562    setCanShowFlagLine(t33) {
563        this.canShowFlagLine = t33;
564    }
565
566    getCanShowFlagLine() {
567        return this.canShowFlagLine;
568    }
569
570    setFlagLineLeftMargin(s33) {
571        if (s33 === undefined) {
572            return;
573        }
574        this.flagLineLeftMargin = s33 * LEVEL_MARGIN + MARGIN_OFFSET;
575    }
576
577    getFlagLineLeftMargin() {
578        return this.flagLineLeftMargin;
579    }
580
581    getNodeLevel() {
582        return this.node.nodeLevel;
583    }
584
585    setIsOverBorder(r33) {
586        this.isOverBorder = r33;
587    }
588
589    getIsOverBorder() {
590        return this.isOverBorder;
591    }
592
593    setCanShowBottomFlagLine(q33) {
594        this.canShowBottomFlagLine = q33;
595    }
596
597    getCanShowBottomFlagLine() {
598        return this.canShowBottomFlagLine;
599    }
600
601    setIsHighLight(p33) {
602        this.isHighLight = p33;
603    }
604
605    getIsHighLight() {
606        return this.isHighLight;
607    }
608
609    setIsModify(o33) {
610        this.isModify = o33;
611    }
612
613    getIsModify() {
614        return this.isModify;
615    }
616};
617NodeInfo = __decorate([
618    Observed
619], NodeInfo);
620
621export { NodeInfo };
622
623export var TreeListenType;
624(function (n33) {
625    n33['NODE_CLICK'] = 'NodeClick';
626    n33['NODE_ADD'] = 'NodeAdd';
627    n33['NODE_DELETE'] = 'NodeDelete';
628    n33['NODE_MODIFY'] = 'NodeModify';
629    n33['NODE_MOVE'] = 'NodeMove';
630})(TreeListenType || (TreeListenType = {}));
631
632export class TreeListener {
633    constructor() {
634        this._events = [];
635        this._once_events = [];
636    }
637
638    on(j33, k33) {
639        if (Array.isArray(j33)) {
640            for (let l33 = 0, m33 = j33.length; l33 < m33; l33++) {
641                this.on(j33[l33], k33);
642            }
643        } else {
644            (this._events[j33] || (this._events[j33] = [])).push(k33);
645        }
646    }
647
648    once(h33, i33) {
649        if (Array.isArray(h33)) {
650            this.off(h33, i33);
651        } else {
652            (this._once_events[h33] || (this._once_events[h33] = [])).push(i33);
653        }
654    }
655
656    off(a33, b33) {
657        if (a33 === null) {
658            this._events = [];
659        }
660        if (Array.isArray(a33)) {
661            for (let f33 = 0, g33 = a33.length; f33 < g33; f33++) {
662                this.off(a33[f33], b33);
663            }
664        }
665        let c33 = this._events[a33];
666        if (!c33) {
667            return;
668        }
669        if (b33 === null) {
670            this._events[a33] = null;
671        }
672        let d33 = c33.length;
673        while (d33--) {
674            let e33 = c33[d33];
675            if (e33 === b33) {
676                c33.splice(d33, 1);
677                break;
678            }
679        }
680    }
681
682    emit(q32, r32) {
683        if (this._once_events[q32]) {
684            let w32 = Array.from(this._once_events[q32]);
685            if (w32) {
686                for (let x32 = 0, y32 = w32.length; x32 < y32; x32++) {
687                    try {
688                        w32[x32](r32);
689                    } catch (z32) {
690                        throw new Error('once function callbacks error.');
691                    }
692                }
693                this._once_events[q32] = null;
694            }
695        } else if (this._events[q32]) {
696            let s32 = Array.from(this._events[q32]);
697            if (s32) {
698                for (let t32 = 0, u32 = s32.length; t32 < u32; t32++) {
699                    try {
700                        s32[t32](r32);
701                    } catch (v32) {
702                        throw new Error('on function callbacks error.');
703                    }
704                }
705            }
706        }
707    }
708}
709
710export class TreeListenerManager {
711    constructor() {
712        this.appEventBus = new TreeListener();
713    }
714
715    static getInstance() {
716        if (AppStorage.Get('app_key_event_bus') === undefined) {
717            AppStorage.SetOrCreate('app_key_event_bus', new TreeListenerManager());
718        }
719        return AppStorage.Get('app_key_event_bus');
720    }
721
722    getTreeListener() {
723        return this.appEventBus;
724    }
725}
726TreeListenerManager.APP_KEY_EVENT_BUS = 'app_key_event_bus';
727
728export class TreeView extends ViewPU {
729    constructor(k32, l32, m32, n32 = -1, o32 = undefined, p32) {
730        super(k32, m32, n32, p32);
731        if (typeof o32 === 'function') {
732            this.paramsGenerator_ = o32;
733        }
734        this.treeController = new TreeController();
735        this.__nodeList = new ObservedPropertyObjectPU([], this, 'nodeList');
736        this.listNodeDataSource = new ListNodeDataSource();
737        this.__item = new ObservedPropertyObjectPU(null, this, 'item');
738        this.__touchCount = new ObservedPropertySimplePU(0, this, 'touchCount');
739        this.__dropSelectedIndex = new ObservedPropertySimplePU(0, this, 'dropSelectedIndex');
740        this.__viewLastIndex = new ObservedPropertySimplePU(-1, this, 'viewLastIndex');
741        this.__followingSystemFontScale = new ObservedPropertySimplePU(false, this, 'followingSystemFontScale');
742        this.__maxAppFontScale = new ObservedPropertySimplePU(1, this, 'maxAppFontScale');
743        this.__listItemBgColor = new ObservedPropertyObjectPU({
744            'id': -1,
745            'type': 10001,
746            params: ['sys.color.ohos_id_color_background_transparent'],
747            'bundleName': '__harDefaultBundleName__',
748            'moduleName': '__harDefaultModuleName__',
749        }, this, 'listItemBgColor');
750        this.__allParentNode = new ObservedPropertyObjectPU([], this, 'allParentNode');
751        this.__treeViewTheme = new ObservedPropertyObjectPU(TreeViewTheme.getInstance(), this, 'treeViewTheme');
752        this.addProvidedVar('treeViewTheme', this.__treeViewTheme, false);
753        this.__clickButtonFlag = new ObservedPropertySimplePU(true, this, 'clickButtonFlag');
754        this.addProvidedVar('clickButtonFlag', this.__clickButtonFlag, false);
755        this.__accessibilityNodeType =
756            new ObservedPropertySimplePU(AccessibilityNodeType.TEXT, this, 'accessibilityNodeType');
757        this.addProvidedVar('accessibilityNodeType', this.__accessibilityNodeType, false);
758        this.__isAccessibilityEnabled =
759            new ObservedPropertySimplePU(accessibility.isScreenReaderOpenSync(), this, 'isAccessibilityEnabled');
760        this.addProvidedVar('isAccessibilityEnabled', this.__isAccessibilityEnabled, false);
761        this.listTreeViewMenu = this.NullBuilder;
762        this.MAX_CN_LENGTH = 254;
763        this.MAX_EN_LENGTH = 255;
764        this.INITIAL_INVALID_VALUE = -1;
765        this.MAX_TOUCH_DOWN_COUNT = 0;
766        this.isMultiPress = false;
767        this.touchDownCount = this.INITIAL_INVALID_VALUE;
768        this.appEventBus = TreeListenerManager.getInstance().getTreeListener();
769        this.itemPadding = {
770            left: {
771                'id': -1,
772                'type': 10002,
773                params: ['sys.float.ohos_id_card_margin_start'],
774                'bundleName': '__harDefaultBundleName__',
775                'moduleName': '__harDefaultModuleName__',
776            },
777            right: {
778                'id': -1,
779                'type': 10002,
780                params: ['sys.float.ohos_id_card_margin_end'],
781                'bundleName': '__harDefaultBundleName__',
782                'moduleName': '__harDefaultModuleName__',
783            },
784            top: {
785                'id': -1,
786                'type': 10002,
787                params: ['sys.float.ohos_id_text_margin_vertical'],
788                'bundleName': '__harDefaultBundleName__',
789                'moduleName': '__harDefaultModuleName__',
790            },
791            bottom: {
792                'id': -1,
793                'type': 10002,
794                params: ['sys.float.ohos_id_text_margin_vertical'],
795                'bundleName': '__harDefaultBundleName__',
796                'moduleName': '__harDefaultModuleName__',
797            },
798        };
799        this.textInputPadding = {
800            left: {
801                'id': -1,
802                'type': 10002,
803                params: ['sys.float.padding_level0'],
804                'bundleName': '__harDefaultBundleName__',
805                'moduleName': '__harDefaultModuleName__',
806            },
807            right: {
808                'id': -1,
809                'type': 10002,
810                params: ['sys.float.padding_level0'],
811                'bundleName': '__harDefaultBundleName__',
812                'moduleName': '__harDefaultModuleName__',
813            },
814            top: {
815                'id': -1,
816                'type': 10002,
817                params: ['sys.float.padding_level0'],
818                'bundleName': '__harDefaultBundleName__',
819                'moduleName': '__harDefaultModuleName__',
820            },
821            bottom: {
822                'id': -1,
823                'type': 10002,
824                params: ['sys.float.padding_level0'],
825                'bundleName': '__harDefaultBundleName__',
826                'moduleName': '__harDefaultModuleName__',
827            },
828        };
829        this.setInitiallyProvidedValue(l32);
830        this.finalizeConstruction();
831    }
832
833    setInitiallyProvidedValue(j32) {
834        if (j32.treeController !== undefined) {
835            this.treeController = j32.treeController;
836        }
837        if (j32.nodeList !== undefined) {
838            this.nodeList = j32.nodeList;
839        }
840        if (j32.listNodeDataSource !== undefined) {
841            this.listNodeDataSource = j32.listNodeDataSource;
842        }
843        if (j32.item !== undefined) {
844            this.item = j32.item;
845        }
846        if (j32.touchCount !== undefined) {
847            this.touchCount = j32.touchCount;
848        }
849        if (j32.dropSelectedIndex !== undefined) {
850            this.dropSelectedIndex = j32.dropSelectedIndex;
851        }
852        if (j32.viewLastIndex !== undefined) {
853            this.viewLastIndex = j32.viewLastIndex;
854        }
855        if (j32.followingSystemFontScale !== undefined) {
856            this.followingSystemFontScale = j32.followingSystemFontScale;
857        }
858        if (j32.maxAppFontScale !== undefined) {
859            this.maxAppFontScale = j32.maxAppFontScale;
860        }
861        if (j32.listItemBgColor !== undefined) {
862            this.listItemBgColor = j32.listItemBgColor;
863        }
864        if (j32.allParentNode !== undefined) {
865            this.allParentNode = j32.allParentNode;
866        }
867        if (j32.treeViewTheme !== undefined) {
868            this.treeViewTheme = j32.treeViewTheme;
869        }
870        if (j32.clickButtonFlag !== undefined) {
871            this.clickButtonFlag = j32.clickButtonFlag;
872        }
873        if (j32.accessibilityNodeType !== undefined) {
874            this.accessibilityNodeType = j32.accessibilityNodeType;
875        }
876        if (j32.isAccessibilityEnabled !== undefined) {
877            this.isAccessibilityEnabled = j32.isAccessibilityEnabled;
878        }
879        if (j32.listTreeViewMenu !== undefined) {
880            this.listTreeViewMenu = j32.listTreeViewMenu;
881        }
882        if (j32.MAX_CN_LENGTH !== undefined) {
883            this.MAX_CN_LENGTH = j32.MAX_CN_LENGTH;
884        }
885        if (j32.MAX_EN_LENGTH !== undefined) {
886            this.MAX_EN_LENGTH = j32.MAX_EN_LENGTH;
887        }
888        if (j32.INITIAL_INVALID_VALUE !== undefined) {
889            this.INITIAL_INVALID_VALUE = j32.INITIAL_INVALID_VALUE;
890        }
891        if (j32.MAX_TOUCH_DOWN_COUNT !== undefined) {
892            this.MAX_TOUCH_DOWN_COUNT = j32.MAX_TOUCH_DOWN_COUNT;
893        }
894        if (j32.isMultiPress !== undefined) {
895            this.isMultiPress = j32.isMultiPress;
896        }
897        if (j32.touchDownCount !== undefined) {
898            this.touchDownCount = j32.touchDownCount;
899        }
900        if (j32.appEventBus !== undefined) {
901            this.appEventBus = j32.appEventBus;
902        }
903        if (j32.itemPadding !== undefined) {
904            this.itemPadding = j32.itemPadding;
905        }
906        if (j32.textInputPadding !== undefined) {
907            this.textInputPadding = j32.textInputPadding;
908        }
909    }
910
911    updateStateVars(i32) {
912    }
913
914    purgeVariableDependenciesOnElmtId(h32) {
915        this.__nodeList.purgeDependencyOnElmtId(h32);
916        this.__item.purgeDependencyOnElmtId(h32);
917        this.__touchCount.purgeDependencyOnElmtId(h32);
918        this.__dropSelectedIndex.purgeDependencyOnElmtId(h32);
919        this.__viewLastIndex.purgeDependencyOnElmtId(h32);
920        this.__followingSystemFontScale.purgeDependencyOnElmtId(h32);
921        this.__maxAppFontScale.purgeDependencyOnElmtId(h32);
922        this.__listItemBgColor.purgeDependencyOnElmtId(h32);
923        this.__allParentNode.purgeDependencyOnElmtId(h32);
924        this.__treeViewTheme.purgeDependencyOnElmtId(h32);
925        this.__clickButtonFlag.purgeDependencyOnElmtId(h32);
926        this.__accessibilityNodeType.purgeDependencyOnElmtId(h32);
927        this.__isAccessibilityEnabled.purgeDependencyOnElmtId(h32);
928    }
929
930    aboutToBeDeleted() {
931        this.__nodeList.aboutToBeDeleted();
932        this.__item.aboutToBeDeleted();
933        this.__touchCount.aboutToBeDeleted();
934        this.__dropSelectedIndex.aboutToBeDeleted();
935        this.__viewLastIndex.aboutToBeDeleted();
936        this.__followingSystemFontScale.aboutToBeDeleted();
937        this.__maxAppFontScale.aboutToBeDeleted();
938        this.__listItemBgColor.aboutToBeDeleted();
939        this.__allParentNode.aboutToBeDeleted();
940        this.__treeViewTheme.aboutToBeDeleted();
941        this.__clickButtonFlag.aboutToBeDeleted();
942        this.__accessibilityNodeType.aboutToBeDeleted();
943        this.__isAccessibilityEnabled.aboutToBeDeleted();
944        SubscriberManager.Get().delete(this.id__());
945        this.aboutToBeDeletedInternal();
946    }
947
948    get nodeList() {
949        return this.__nodeList.get();
950    }
951
952    set nodeList(g32) {
953        this.__nodeList.set(g32);
954    }
955
956    get item() {
957        return this.__item.get();
958    }
959
960    set item(f32) {
961        this.__item.set(f32);
962    }
963
964    get touchCount() {
965        return this.__touchCount.get();
966    }
967
968    set touchCount(e32) {
969        this.__touchCount.set(e32);
970    }
971
972    get dropSelectedIndex() {
973        return this.__dropSelectedIndex.get();
974    }
975
976    set dropSelectedIndex(d32) {
977        this.__dropSelectedIndex.set(d32);
978    }
979
980    get viewLastIndex() {
981        return this.__viewLastIndex.get();
982    }
983
984    set viewLastIndex(c32) {
985        this.__viewLastIndex.set(c32);
986    }
987
988    get followingSystemFontScale() {
989        return this.__followingSystemFontScale.get();
990    }
991
992    set followingSystemFontScale(b32) {
993        this.__followingSystemFontScale.set(b32);
994    }
995
996    get maxAppFontScale() {
997        return this.__maxAppFontScale.get();
998    }
999
1000    set maxAppFontScale(a32) {
1001        this.__maxAppFontScale.set(a32);
1002    }
1003
1004    get listItemBgColor() {
1005        return this.__listItemBgColor.get();
1006    }
1007
1008    set listItemBgColor(z31) {
1009        this.__listItemBgColor.set(z31);
1010    }
1011
1012    get allParentNode() {
1013        return this.__allParentNode.get();
1014    }
1015
1016    set allParentNode(y31) {
1017        this.__allParentNode.set(y31);
1018    }
1019
1020    get treeViewTheme() {
1021        return this.__treeViewTheme.get();
1022    }
1023
1024    set treeViewTheme(x31) {
1025        this.__treeViewTheme.set(x31);
1026    }
1027
1028    get clickButtonFlag() {
1029        return this.__clickButtonFlag.get();
1030    }
1031
1032    set clickButtonFlag(w31) {
1033        this.__clickButtonFlag.set(w31);
1034    }
1035
1036    get accessibilityNodeType() {
1037        return this.__accessibilityNodeType.get();
1038    }
1039
1040    set accessibilityNodeType(v31) {
1041        this.__accessibilityNodeType.set(v31);
1042    }
1043
1044    get isAccessibilityEnabled() {
1045        return this.__isAccessibilityEnabled.get();
1046    }
1047
1048    set isAccessibilityEnabled(u31) {
1049        this.__isAccessibilityEnabled.set(u31);
1050    }
1051
1052    NullBuilder(t31 = null) {
1053    }
1054
1055    onWillApplyTheme(s31) {
1056        this.treeViewTheme.itemSelectedBgColor = s31.colors.interactiveSelect;
1057        this.treeViewTheme.itemPressedBgColor = s31.colors.interactivePressed;
1058        this.treeViewTheme.itemHoverBgColor = s31.colors.interactiveHover;
1059        this.treeViewTheme.primaryTitleFontColor = s31.colors.fontPrimary;
1060        this.treeViewTheme.secondaryTitleFontColor = s31.colors.fontSecondary;
1061        this.treeViewTheme.primaryTitleActiveFontColor = s31.colors.interactiveActive;
1062        this.treeViewTheme.borderFocusedColor = s31.colors.interactiveFocus;
1063        this.treeViewTheme.leftIconColor = s31.colors.iconSecondary;
1064        this.treeViewTheme.leftIconActiveColor = s31.colors.interactiveActive;
1065        this.treeViewTheme.arrowIconColor = s31.colors.iconPrimary;
1066        this.treeController.treeViewTheme = this.treeViewTheme;
1067    }
1068
1069    aboutToAppear() {
1070        if (this.treeController !== null) {
1071            this.listNodeDataSource = this.treeController.getListNodeDataSource();
1072            this.nodeList = this.treeController.getListNodeDataSource().listNode;
1073            this.item = this.treeController.getListNodeDataSource().listNode;
1074        }
1075        let p31 = this.getUIContext();
1076        this.followingSystemFontScale = p31.isFollowingSystemFontScale();
1077        this.maxAppFontScale = p31.getMaxFontScale();
1078        accessibility.on('screenReaderStateChange', (r31) => {
1079            this.isAccessibilityEnabled = r31;
1080        });
1081    }
1082
1083    decideFontScale() {
1084        let n31 = this.getUIContext();
1085        let o31 = n31.getHostContext()?.config?.fontSizeScale ?? 1;
1086        if (!this.followingSystemFontScale) {
1087            return 1;
1088        }
1089        return Math.min(o31, this.maxAppFontScale, MAX_FONT_SCALE);
1090    }
1091
1092    decideSymbolFontScale(j31) {
1093        if (!j31 || !this.followingSystemFontScale) {
1094            return 1;
1095        }
1096        let k31 = this.getUIContext();
1097        let l31 = k31.getHostContext()?.config?.fontSizeScale ?? 1;
1098        let m31 = Math.min(l31, this.maxAppFontScale, MAX_SYMBOL_FONT_SCALE);
1099        return Math.max(m31, MIN_SYMBOL_FONT_SCALE);
1100    }
1101
1102    popupForShowTitle(z30, a31, b31, c31 = null) {
1103        this.observeComponentCreation2((h31, i31) => {
1104            Row.create();
1105            Row.backgroundColor(a31);
1106            Row.border({
1107                radius: {
1108                    'id': -1,
1109                    'type': 10002,
1110                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
1111                    'bundleName': '__harDefaultBundleName__',
1112                    'moduleName': '__harDefaultModuleName__',
1113                }
1114            });
1115            Row.padding({
1116                left: {
1117                    'id': -1,
1118                    'type': 10002,
1119                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
1120                    'bundleName': '__harDefaultBundleName__',
1121                    'moduleName': '__harDefaultModuleName__',
1122                },
1123                right: {
1124                    'id': -1,
1125                    'type': 10002,
1126                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
1127                    'bundleName': '__harDefaultBundleName__',
1128                    'moduleName': '__harDefaultModuleName__',
1129                },
1130                top: {
1131                    'id': -1,
1132                    'type': 10002,
1133                    params: ['sys.float.ohos_id_card_margin_middle'],
1134                    'bundleName': '__harDefaultBundleName__',
1135                    'moduleName': '__harDefaultModuleName__',
1136                },
1137                bottom: {
1138                    'id': -1,
1139                    'type': 10002,
1140                    params: ['sys.float.ohos_id_card_margin_middle'],
1141                    'bundleName': '__harDefaultBundleName__',
1142                    'moduleName': '__harDefaultModuleName__',
1143                },
1144            });
1145        }, Row);
1146        this.observeComponentCreation2((f31, g31) => {
1147            Text.create(z30);
1148            Text.fontSize({
1149                'id': -1,
1150                'type': 10002,
1151                params: ['sys.float.ohos_id_text_size_body2'],
1152                'bundleName': '__harDefaultBundleName__',
1153                'moduleName': '__harDefaultModuleName__',
1154            });
1155            Text.fontWeight('regular');
1156            Text.fontColor(b31);
1157            Text.minFontScale(MIN_FONT_SCALE);
1158            Text.maxFontScale(this.decideFontScale());
1159        }, Text);
1160        Text.pop();
1161        Row.pop();
1162    }
1163
1164    builder(y30 = null) {
1165        this.listTreeViewMenu.bind(this)();
1166    }
1167
1168    draggingPopup(h29, i29 = null) {
1169        this.observeComponentCreation2((w30, x30) => {
1170            Row.create();
1171            Row.id(`treeView_node_lift${h29.getNodeCurrentNodeId()}`);
1172            Row.constraintSize({
1173                minWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.minWidth,
1174                maxWidth: this.listNodeDataSource.getDragPopupPara().floorConstraintSize.maxWidth,
1175            });
1176            Row.height(this.listNodeDataSource.getDragPopupPara().height);
1177            Row.backgroundColor(this.listNodeDataSource.getDragPopupPara().backgroundColor);
1178            Row.padding({
1179                start: LengthMetrics.resource(this.listNodeDataSource.getDragPopupPara().padding.left),
1180                end: LengthMetrics.resource(this.listNodeDataSource.getDragPopupPara().padding.right),
1181            });
1182            Row.shadow(this.listNodeDataSource.getDragPopupPara().shadow);
1183            Row.borderRadius(this.listNodeDataSource.getDragPopupPara().borderRadius);
1184        }, Row);
1185        this.observeComponentCreation2((w29, x29) => {
1186            If.create();
1187            if (h29.getNodeItem().imageNode) {
1188                this.ifElseBranchUpdateFunction(0, () => {
1189                    this.observeComponentCreation2((u30, v30) => {
1190                        Row.create();
1191                        Row.backgroundColor(COLOR_IMAGE_ROW);
1192                        Row.margin({
1193                            end: getLengthMetricsByResourceOrNumber(h29.getNodeItem().imageNode?.itemRightMargin)
1194                        });
1195                        Row.height(h29.getNodeItem().imageNode?.itemHeight *
1196                        this.decideSymbolFontScale(h29.getNodeItem().imageNode?.symbolNormalSource !== undefined ||
1197                        Util.isSymbolResource(h29.getNodeItem().imageNode?.normalSource)));
1198                        Row.width(h29.getNodeItem().imageNode?.itemWidth *
1199                        this.decideSymbolFontScale(h29.getNodeItem().imageNode?.symbolNormalSource !== undefined ||
1200                        Util.isSymbolResource(h29.getNodeItem().imageNode?.normalSource)));
1201                    }, Row);
1202                    this.observeComponentCreation2((c30, d30) => {
1203                        If.create();
1204                        if (h29.getNodeItem().imageNode?.symbolNormalSource) {
1205                            this.ifElseBranchUpdateFunction(0, () => {
1206                                this.observeComponentCreation2((s30, t30) => {
1207                                    SymbolGlyph.create();
1208                                    SymbolGlyph.attributeModifier.bind(this)(h29.getNodeItem()
1209                                        .imageNode?.symbolNormalSource);
1210                                    SymbolGlyph.fontSize(`${h29.getNodeItem().imageNode?.itemHeight *
1211                                    this.decideSymbolFontScale(true)}vp`);
1212                                    SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE);
1213                                    SymbolGlyph.symbolEffect(new SymbolEffect(), false);
1214                                    SymbolGlyph.opacity(this.listNodeDataSource.getDragPopupPara().imageOpacity);
1215                                }, SymbolGlyph);
1216                            });
1217                        } else {
1218                            this.ifElseBranchUpdateFunction(1, () => {
1219                                this.observeComponentCreation2((g30, h30) => {
1220                                    If.create();
1221                                    if (Util.isSymbolResource(h29.getNodeItem().imageNode?.normalSource)) {
1222                                        this.ifElseBranchUpdateFunction(0, () => {
1223                                            this.observeComponentCreation2((o30, p30) => {
1224                                                SymbolGlyph.create(h29.getNodeItem().imageNode?.normalSource);
1225                                                SymbolGlyph.fontSize(`${h29.getNodeItem().imageNode?.itemHeight *
1226                                                this.decideSymbolFontScale(true)}vp`);
1227                                                SymbolGlyph.opacity(this.listNodeDataSource.getDragPopupPara()
1228                                                    .imageOpacity);
1229                                            }, SymbolGlyph);
1230                                        });
1231                                    } else {
1232                                        this.ifElseBranchUpdateFunction(1, () => {
1233                                            this.observeComponentCreation2((k30, l30) => {
1234                                                Image.create(h29.getNodeItem().imageNode?.normalSource);
1235                                                Image.objectFit(ImageFit.Contain);
1236                                                Image.height(h29.getNodeItem().imageNode?.itemHeight);
1237                                                Image.width(h29.getNodeItem().imageNode?.itemWidth);
1238                                                Image.opacity(this.listNodeDataSource.getDragPopupPara().imageOpacity);
1239                                                Image.matchTextDirection((h29.getNodeItem()
1240                                                    .imageCollapse?.collapseSource === ARROW_RIGHT ||
1241                                                    h29.getNodeItem().imageCollapse?.collapseSource ===
1242                                                        ARROW_RIGHT_WITHE) ? true : false);
1243                                            }, Image);
1244                                        });
1245                                    }
1246                                }, If);
1247                                If.pop();
1248                            });
1249                        }
1250                    }, If);
1251                    If.pop();
1252                    Row.pop();
1253                });
1254            } else {
1255                this.ifElseBranchUpdateFunction(1, () => {
1256                });
1257            }
1258        }, If);
1259        If.pop();
1260        this.observeComponentCreation2((u29, v29) => {
1261            Row.create();
1262            Row.constraintSize({
1263                minWidth: h29.getNodeItem().imageNode ?
1264                this.listNodeDataSource.getDragPopupPara().textConstraintSize.minWidth1 :
1265                this.listNodeDataSource.getDragPopupPara().textConstraintSize.minWidth2,
1266                maxWidth: h29.getNodeItem().imageNode ?
1267                this.listNodeDataSource.getDragPopupPara().textConstraintSize.maxWidth1 :
1268                this.listNodeDataSource.getDragPopupPara().textConstraintSize.maxWidth2,
1269            });
1270        }, Row);
1271        this.observeComponentCreation2((n29, o29) => {
1272            If.create();
1273            if (h29.getNodeItem().mainTitleNode && h29.getIsShowTitle()) {
1274                this.ifElseBranchUpdateFunction(0, () => {
1275                    this.observeComponentCreation2((s29, t29) => {
1276                        Text.create(h29.getNodeItem().mainTitleNode?.title);
1277                        Text.maxLines(1);
1278                        Text.minFontScale(MIN_FONT_SCALE);
1279                        Text.maxFontScale(this.decideFontScale());
1280                        Text.fontSize(h29.getNodeItem().mainTitleNode?.size);
1281                        Text.fontColor(this.listNodeDataSource.getDragPopupPara().fontColor);
1282                        Text.fontWeight(this.listNodeDataSource.getDragPopupPara().fontWeight);
1283                        Text.textOverflow({ overflow: TextOverflow.Ellipsis });
1284                    }, Text);
1285                    Text.pop();
1286                });
1287            } else {
1288                this.ifElseBranchUpdateFunction(1, () => {
1289                });
1290            }
1291        }, If);
1292        If.pop();
1293        Row.pop();
1294        Row.pop();
1295    }
1296
1297    clearLastIndexColor() {
1298        if (this.viewLastIndex === -1 || this.viewLastIndex >= this.nodeList.length) {
1299            return;
1300        }
1301        this.setImageSources(this.viewLastIndex, InteractionStatus.NORMAL);
1302        this.listNodeDataSource.setImageSource(this.viewLastIndex, InteractionStatus.NORMAL);
1303        this.nodeList[this.viewLastIndex].setNodeColor({
1304            'id': -1,
1305            'type': 10001,
1306            params: ['sys.color.ohos_id_color_background_transparent'],
1307            'bundleName': '__harDefaultBundleName__',
1308            'moduleName': '__harDefaultModuleName__',
1309        });
1310        this.nodeList[this.viewLastIndex].fontColor = this.treeViewTheme.primaryTitleFontColor;
1311        this.listNodeDataSource.listNode[this.viewLastIndex].setNodeColor({
1312            'id': -1,
1313            'type': 10001,
1314            params: ['sys.color.ohos_id_color_background_transparent'],
1315            'bundleName': '__harDefaultBundleName__',
1316            'moduleName': '__harDefaultModuleName__',
1317        });
1318        this.listNodeDataSource.listNode[this.viewLastIndex].fontColor = this.treeViewTheme.primaryTitleFontColor;
1319        this.listNodeDataSource.listNode[this.viewLastIndex].setIsSelected(false);
1320        this.listNodeDataSource.listNode[this.viewLastIndex].imageSource =
1321            this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1322                .imageNode?.source;
1323        this.listNodeDataSource.listNode[this.viewLastIndex].symbolSource =
1324            this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1325                .imageNode?.symbolSource;
1326    }
1327
1328    setImageSources(e29, f29) {
1329        let g29 = this.nodeList[e29];
1330        g29.setIsSelected(f29 === InteractionStatus.SELECTED ||
1331            f29 === InteractionStatus.EDIT || f29 === InteractionStatus.FINISH_EDIT);
1332        if (g29.getNodeItem().mainTitleNode !== null && f29 !== InteractionStatus.DRAG_INSERT &&
1333            f29 !== InteractionStatus.FINISH_DRAG_INSERT) {
1334            g29.getNodeItem().mainTitleNode?.setMainTitleSelected(f29 === InteractionStatus.SELECTED ||
1335                f29 === InteractionStatus.FINISH_EDIT);
1336        }
1337        if (g29.getNodeItem().imageNode !== null) {
1338            g29.getNodeItem().imageNode?.setImageSource(f29);
1339        }
1340    }
1341
1342    touchInner(b29, c29) {
1343        this.viewLastIndex = this.listNodeDataSource.getLastIndex();
1344        let d29 = this.listNodeDataSource.findIndex(b29.getNodeCurrentNodeId());
1345        if (c29.type === TouchType.Down) {
1346            if (d29 !== this.viewLastIndex) {
1347                this.clearLastIndexColor();
1348                this.listNodeDataSource.lastIndex = d29;
1349                this.listNodeDataSource.setClickIndex(d29);
1350            }
1351        }
1352        if (c29.type === TouchType.Up) {
1353            this.listNodeDataSource.listNode[d29].setIsSelected(true);
1354            this.listNodeDataSource.setImageSource(d29, InteractionStatus.SELECTED);
1355            if (this.listNodeDataSource.listNode[d29].getNodeItem().imageNode !== null) {
1356                this.listNodeDataSource.listNode[d29].imageSource = this.listNodeDataSource.listNode[d29]
1357                    .getNodeItem().imageNode?.source;
1358                this.listNodeDataSource.listNode[d29].symbolSource = this.listNodeDataSource.listNode[d29]
1359                    .getNodeItem().imageNode?.symbolSource;
1360            }
1361            if (d29 !== this.viewLastIndex) {
1362                this.clearLastIndexColor();
1363                this.listNodeDataSource.lastIndex = d29;
1364                this.listNodeDataSource.setClickIndex(d29);
1365            }
1366            this.viewLastIndex = d29;
1367        }
1368        if (this.listNodeDataSource.getLastIndex() !== -1 && d29 !== this.listNodeDataSource.getLastIndex()) {
1369            this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false,
1370                this.listNodeDataSource.getLastIndex());
1371            this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(),
1372                MenuOperation.COMMIT_NODE);
1373        }
1374    }
1375
1376    clickInner(z28) {
1377        this.viewLastIndex = this.listNodeDataSource.getLastIndex();
1378        let a29 = this.listNodeDataSource.findIndex(z28.getNodeCurrentNodeId());
1379        if (a29 !== this.viewLastIndex) {
1380            this.clearLastIndexColor();
1381            this.listNodeDataSource.lastIndex = a29;
1382            this.listNodeDataSource.setClickIndex(a29);
1383        }
1384        this.listNodeDataSource.listNode[a29].setIsSelected(true);
1385        this.listNodeDataSource.setImageSource(a29, InteractionStatus.SELECTED);
1386        if (this.listNodeDataSource.listNode[a29].getNodeItem().imageNode !== null) {
1387            this.listNodeDataSource.listNode[a29].imageSource = this.listNodeDataSource.listNode[a29]
1388                .getNodeItem().imageNode?.source;
1389            this.listNodeDataSource.listNode[a29].symbolSource = this.listNodeDataSource.listNode[a29]
1390                .getNodeItem().imageNode?.symbolSource;
1391        }
1392        if (a29 !== this.viewLastIndex) {
1393            this.clearLastIndexColor();
1394            this.listNodeDataSource.lastIndex = a29;
1395            this.listNodeDataSource.setClickIndex(a29);
1396        }
1397        this.viewLastIndex = a29;
1398        if (this.listNodeDataSource.getLastIndex() !== -1 && a29 !== this.listNodeDataSource.getLastIndex()) {
1399            this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false,
1400                this.listNodeDataSource.getLastIndex());
1401            this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(),
1402                MenuOperation.COMMIT_NODE);
1403        }
1404    }
1405
1406    initialRender() {
1407        this.observeComponentCreation2((j27, k27) => {
1408            List.create({});
1409            List.onDragMove((q28, r28) => {
1410                if (this.isMultiPress) {
1411                    hilog.error(LOG_CODE, TAG, 'drag error, a item has been dragged');
1412                    return;
1413                }
1414                let s28 = LIST_ITEM_HEIGHT;
1415                let t28 = Math.floor(q28.getY() /
1416                    (s28 / FLAG_NUMBER)) %
1417                    FLAG_NUMBER ? Flag.DOWN_FLAG : Flag.UP_FLAG;
1418                let u28 = JSON.parse(r28).insertIndex;
1419                let v28 = false;
1420                if (u28 >= this.listNodeDataSource.totalCount()) {
1421                    t28 = Flag.DOWN_FLAG;
1422                    u28 = this.listNodeDataSource.totalCount() - 1;
1423                    this.listNodeDataSource.getData(u28)?.setIsOverBorder(true);
1424                    v28 = true;
1425                } else {
1426                    this.listNodeDataSource.getData(u28)?.setIsOverBorder(false);
1427                }
1428                let w28 = this.listNodeDataSource.getData(u28);
1429                let x28 = w28?.getNodeCurrentNodeId();
1430                if (u28 !== this.listNodeDataSource.getLastPassIndex() && this.listNodeDataSource.getIsInnerDrag()) {
1431                    let y28 = this.listNodeDataSource.getIsParentOfInsertNode(x28);
1432                    if (y28) {
1433                        this.listNodeDataSource.setPassIndex(u28);
1434                        if (x28 !== undefined) {
1435                            this.listNodeDataSource.clearTimeOutAboutDelayHighLightAndExpand(this.listNodeDataSource.findIndex(x28));
1436                        }
1437                        this.listNodeDataSource.setFlag(Flag.NONE);
1438                        return;
1439                    }
1440                }
1441                this.listNodeDataSource.setLastPassIndex(u28);
1442                this.listNodeDataSource.setVisibility(t28, u28 - 1, v28,
1443                    ObservedObject.GetRawObject(this.allParentNode));
1444                if (x28 !== undefined && x28 !== this.listNodeDataSource.getDraggingCurrentNodeId()) {
1445                    this.listNodeDataSource.delayHighLightAndExpandNode(this.listNodeDataSource.findIndex(x28), x28,
1446                        u28);
1447                }
1448            });
1449            List.onDragEnter((n28, o28) => {
1450                if (this.listNodeDataSource.getIsInnerDrag()) {
1451                    this.listNodeDataSource.setIsDrag(true);
1452                    let p28 = DRAG_OPACITY;
1453                    this.listNodeDataSource.setListItemOpacity(p28);
1454                }
1455            });
1456            List.onDragLeave((k28, l28) => {
1457                this.listNodeDataSource.hideLastLine();
1458                this.listNodeDataSource.clearLastTimeoutHighLight();
1459                this.listNodeDataSource.clearLastTimeoutExpand();
1460                let m28 = DRAG_OPACITY_NONE;
1461                this.listNodeDataSource.setListItemOpacity(m28);
1462                this.listNodeDataSource.setIsDrag(false);
1463                this.listNodeDataSource.notifyDataReload();
1464            });
1465            List.onDrop((p27, q27) => {
1466                this.accessibilityNodeType = AccessibilityNodeType.PLACE;
1467                this.listNodeDataSource.clearLastTimeoutExpand();
1468                let r27 = DRAG_OPACITY_NONE;
1469                this.listNodeDataSource.setListItemOpacity(r27);
1470                let s27 = JSON.parse(q27).insertIndex;
1471                let t27 = this.dropSelectedIndex;
1472                if (t27 - 1 > this.listNodeDataSource.totalCount() || t27 === undefined) {
1473                    hilog.error(LOG_CODE, TAG, 'drag error, currentNodeIndex is not found');
1474                    this.listNodeDataSource.setIsDrag(false);
1475                    return;
1476                }
1477                if (s27 === this.listNodeDataSource.totalCount()) {
1478                    hilog.info(LOG_CODE, TAG, 'need to insert into the position of the last line');
1479                    s27 -= 1;
1480                }
1481                let u27 = this.listNodeDataSource.getData(s27);
1482                if (u27 === undefined) {
1483                    return;
1484                }
1485                let v27 = u27.getNodeCurrentNodeId();
1486                if (!this.listNodeDataSource.getIsDrag() || !this.listNodeDataSource.getIsInnerDrag()) {
1487                    this.listNodeDataSource.clearLastTimeoutHighLight();
1488                    this.listNodeDataSource.setIsInnerDrag(false);
1489                    this.listNodeDataSource.hideLastLine();
1490                    this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
1491                    this.listNodeDataSource.refreshSubtitle(v27);
1492                    this.listNodeDataSource.notifyDataReload();
1493                    return;
1494                }
1495                let w27 = this.listNodeDataSource.getCurrentNodeInfo();
1496                let x27 = u27.getNodeParentNodeId();
1497                let y27 = this.listNodeDataSource.getDraggingCurrentNodeId();
1498                let z27 = this.listNodeDataSource.getDraggingParentNodeId();
1499                let a28 = this.listNodeDataSource.getIsParentOfInsertNode(v27);
1500                if (a28) {
1501                    this.listNodeDataSource.clearLastTimeoutHighLight();
1502                    this.listNodeDataSource.setIsInnerDrag(false);
1503                    this.listNodeDataSource.hideLastLine();
1504                    this.listNodeDataSource.notifyDataChange(s27);
1505                    this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
1506                    this.listNodeDataSource.setIsDrag(false);
1507                    let j28 = this.listNodeDataSource.findIndex(y27);
1508                    this.listNodeDataSource.setClickIndex(j28);
1509                    this.listNodeDataSource.handleEvent(Event.DRAG, j28);
1510                    return;
1511                }
1512                if (this.listNodeDataSource.getExpandAndCollapseInfo(y27) === NodeStatus.EXPAND) {
1513                    this.listNodeDataSource.expandAndCollapseNode(this.listNodeDataSource.findIndex(y27));
1514                }
1515                let b28 = false;
1516                if (this.listNodeDataSource.getExpandAndCollapseInfo(v27) === NodeStatus.COLLAPSE) {
1517                    let i28 = this.listNodeDataSource.findIndex(v27);
1518                    if (this.listNodeDataSource.listNode[i28].getIsHighLight()) {
1519                        this.listNodeDataSource.expandAndCollapseNode(i28);
1520                    }
1521                    b28 = true;
1522                }
1523                this.listNodeDataSource.setLastDelayHighLightId();
1524                if (w27 !== null && y27 !== v27) {
1525                    this.listNodeDataSource.alterDragNode(x27, v27, z27, y27, w27);
1526                    this.listNodeDataSource.hideLastLine();
1527                } else {
1528                    this.listNodeDataSource.hideLastLine();
1529                    this.listNodeDataSource.setLastPassId(y27);
1530                    this.listNodeDataSource.hideLastLine();
1531                }
1532                let c28 = this.listNodeDataSource.findIndex(this.listNodeDataSource.getLastDelayHighLightId());
1533                this.listNodeDataSource.setLastDelayHighLightIndex(c28);
1534                this.listNodeDataSource.clearLastTimeoutHighLight();
1535                this.listNodeDataSource.initialParameterAboutDelayHighLightAndExpandIndex();
1536                this.listNodeDataSource.setIsDrag(false);
1537                let d28 = this.listNodeDataSource.findIndex(y27);
1538                this.listNodeDataSource.setClickIndex(d28);
1539                this.listNodeDataSource.handleEvent(Event.DRAG, d28);
1540                this.listNodeDataSource.setIsInnerDrag(false);
1541                this.listNodeDataSource.notifyDataReload();
1542                this.listNodeDataSource.listNode[d28].fontColor = this.treeViewTheme.primaryTitleActiveFontColor;
1543                if (this.viewLastIndex !== -1 && t27 !== this.viewLastIndex) {
1544                    this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1545                        .mainTitleNode?.setMainTitleSelected(false);
1546                    this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1547                        .mainTitleNode?.setMainTitleHighLight(false);
1548                }
1549                this.listNodeDataSource.lastIndex = this.viewLastIndex;
1550                if (this.listNodeDataSource.listNode[this.viewLastIndex]) {
1551                    if (this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1552                        .imageNode !== null) {
1553                        this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1554                            .imageNode?.setImageSource(InteractionStatus.NORMAL);
1555                        this.listNodeDataSource.listNode[this.viewLastIndex].imageSource =
1556                            this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1557                                .imageNode?.source;
1558                        this.listNodeDataSource.listNode[this.viewLastIndex].symbolSource =
1559                            this.listNodeDataSource.listNode[this.viewLastIndex].getNodeItem()
1560                                .imageNode?.symbolSource;
1561                    }
1562                }
1563                if (this.listNodeDataSource.listNode[this.viewLastIndex]) {
1564                    this.listNodeDataSource.listNode[this.viewLastIndex]
1565                        .setNodeColor({
1566                            'id': -1,
1567                            'type': 10001,
1568                            params: ['sys.color.ohos_id_color_background_transparent'],
1569                            'bundleName': '__harDefaultBundleName__',
1570                            'moduleName': '__harDefaultModuleName__',
1571                        });
1572                }
1573                this.listNodeDataSource.lastIndex = d28;
1574                let e28 = w27?.getNodeParentNodeId();
1575                this.listNodeDataSource.judgeImageCollapse(e28);
1576                let f28 = ({
1577                    type: 'requestFocusForAccessibility',
1578                    bundleName: getContext()?.abilityInfo?.bundleName,
1579                    triggerAction: 'common',
1580                    customId: `treeView_node${y27}`
1581                });
1582                accessibility.sendAccessibilityEvent(f28).then(() => {
1583                    setTimeout(() => {
1584                        this.accessibilityNodeType = AccessibilityNodeType.TEXT;
1585                    }, ENTER_EXIT_DURATION);
1586                    console.log(`test123 Succeeded in send event, eventInfo is ${JSON.stringify(f28)}`);
1587                });
1588            });
1589        }, List);
1590        {
1591            const m2 = x25 => {
1592                const y25 = x25;
1593                {
1594                    const k3 = (p26, q26) => {
1595                        ListItem.create(() => {
1596                        }, false);
1597                        ListItem.width('100%');
1598                        ListItem.height(y25.getListItemHeight());
1599                        ListItem.padding({
1600                            start: LengthMetrics.resource(this.itemPadding.left),
1601                            end: LengthMetrics.resource(this.itemPadding.right)
1602                        });
1603                        ListItem.align(Alignment.Start);
1604                        ListItem.onDragStart((t26, u26) => {
1605                            this.accessibilityNodeType = AccessibilityNodeType.LIFT;
1606                            if (this.listNodeDataSource.getIsDrag() || this.listNodeDataSource.getIsInnerDrag() ||
1607                            this.isMultiPress) {
1608                                hilog.error(LOG_CODE, TAG, 'drag error, a item has been dragged');
1609                                return;
1610                            }
1611                            this.dropSelectedIndex = JSON.parse(u26).selectedIndex;
1612                            let v26 = JSON.parse(u26).selectedIndex;
1613                            let w26 = this.listNodeDataSource.getData(v26);
1614                            let x26 = y25.getNodeCurrentNodeId();
1615                            if (v26 >= this.listNodeDataSource.totalCount() || v26 === undefined) {
1616                                hilog.error(LOG_CODE, TAG, 'drag error, currentNodeIndex is not found in onDragStart');
1617                                return;
1618                            }
1619                            this.listNodeDataSource.setIsInnerDrag(true);
1620                            this.listNodeDataSource.setIsDrag(true);
1621                            this.listNodeDataSource.setCurrentNodeInfo(w26);
1622                            this.listNodeDataSource.setDraggingCurrentNodeId(w26?.getNodeCurrentNodeId());
1623                            this.listNodeDataSource.setDraggingParentNodeId(w26?.getNodeParentNodeId());
1624                            let y26 = DRAG_OPACITY;
1625                            this.listNodeDataSource.setListItemOpacity(y26);
1626                            this.listNodeDataSource.notifyDataChange(v26);
1627                            if (x26 !== w26?.getNodeCurrentNodeId()) {
1628                                hilog.error(LOG_CODE, TAG, 'drag is too fast, it attribute a fault to OH');
1629                                this.listNodeDataSource.setIsDrag(false);
1630                                return;
1631                            }
1632                            let z26 = w26.getNodeInfoData()?.primaryTitle === undefined ? '' :
1633                                w26.getNodeInfoData()?.primaryTitle;
1634                            let a27 = w26.getNodeInfoData()?.secondaryTitle === undefined ? '' :
1635                                w26.getNodeInfoData()?.secondaryTitle;
1636                            let b27 = this.listNodeDataSource.getAccessibleTitleText(z26);
1637                            let c27 = this.listNodeDataSource.getAccessibleTitleText(a27);
1638                            let d27 = `${b27}, ${c27}`;
1639                            this.listNodeDataSource.sendAccessibility(this.listNodeDataSource.getStringByName('treeview_accessibility_lift_node',
1640                                d27));
1641                            let e27 = [];
1642                            for (let i27 = 0; i27 < this.listNodeDataSource.listNode.length; i27++) {
1643                                if (this.listNodeDataSource.listNode[i27].getNodeParentNodeId() === -1) {
1644                                    e27.push(this.listNodeDataSource.listNode[i27].getNodeCurrentNodeId());
1645                                }
1646                            }
1647                            this.allParentNode = e27;
1648                            let f27 = ({
1649                                type: 'requestFocusForAccessibility',
1650                                bundleName: getContext()?.abilityInfo?.bundleName,
1651                                triggerAction: 'common',
1652                                customId: `treeView_node_lift${x26}`
1653                            });
1654                            accessibility.sendAccessibilityEvent(f27).then(() => {
1655                                setTimeout(() => {
1656                                    this.accessibilityNodeType = AccessibilityNodeType.TEXT;
1657                                }, ENTER_EXIT_DURATION);
1658                            });
1659                            return {
1660                                builder: () => {
1661                                    this.draggingPopup.call(this, w26);
1662                                }
1663                            };
1664                        });
1665                    };
1666                    const o3 = () => {
1667                        this.observeComponentCreation2(k3, ListItem);
1668                        this.observeComponentCreation2((l26, m26) => {
1669                            Row.create();
1670                            Row.onTouch(this.isAccessibilityEnabled ? undefined : (o26) => {
1671                                this.touchInner(y25, o26);
1672                            });
1673                        }, Row);
1674                        {
1675                            this.observeComponentCreation2((f26, g26) => {
1676                                if (g26) {
1677                                    let h26 = new TreeViewInner(this, {
1678                                        item: y25,
1679                                        listNodeDataSource: this.listNodeDataSource,
1680                                        index: this.listNodeDataSource.findIndex(y25.getNodeCurrentNodeId()),
1681                                        listTreeViewMenu: this.listTreeViewMenu,
1682                                        callBackClick: () => this.clickInner(y25),
1683                                    }, undefined, f26, () => {
1684                                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 1301, col: 13 });
1685                                    ViewPU.create(h26);
1686                                    let n4 = () => {
1687                                        return {
1688                                            item: y25,
1689                                            listNodeDataSource: this.listNodeDataSource,
1690                                            index: this.listNodeDataSource.findIndex(y25.getNodeCurrentNodeId()),
1691                                            listTreeViewMenu: this.listTreeViewMenu,
1692                                            callBackClick: () => this.clickInner(y25)
1693                                        };
1694                                    };
1695                                    h26.paramsGenerator_ = n4;
1696                                } else {
1697                                    this.updateStateVarsOfChildByElmtId(f26, {
1698                                        item: y25
1699                                    });
1700                                }
1701                            }, { name: 'TreeViewInner' });
1702                        }
1703                        Row.pop();
1704                        ListItem.pop();
1705                    };
1706                    o3();
1707                }
1708            };
1709            const y2 = (w25) => JSON.stringify(w25);
1710            LazyForEach.create('1', this, this.listNodeDataSource, m2, y2);
1711            LazyForEach.pop();
1712        }
1713        List.pop();
1714    }
1715
1716    rerender() {
1717        this.updateDirtyElements();
1718    }
1719}
1720
1721export class TreeController {
1722    constructor() {
1723        this.ROOT_NODE_ID = -1;
1724        this.nodeIdList = [];
1725        this.listNodeDataSource = new ListNodeDataSource();
1726        this.initBuild = true;
1727        this.treeViewTheme = TreeViewTheme.getInstance();
1728    }
1729
1730    getListNodeDataSource() {
1731        return this.listNodeDataSource;
1732    }
1733
1734    getClickNodeChildrenInfo() {
1735        let q25 = this.listNodeDataSource.getClickNodeId();
1736        return this.listNodeDataSource.getClickNodeChildrenInfo(q25);
1737    }
1738
1739    getChildrenId() {
1740        let p25 = this.listNodeDataSource.getClickNodeId();
1741        return this.listNodeDataSource.getClickChildId(p25);
1742    }
1743
1744    removeNode() {
1745        let m25 = this.listNodeDataSource.getClickNodeId();
1746        if (m25 < 0) {
1747            return;
1748        }
1749        let n25 = this.listNodeDataSource.findParentNodeId(m25);
1750        let o25 = this.listNodeDataSource.removeNode(m25, n25);
1751        this.listNodeDataSource.refreshData(MenuOperation.REMOVE_NODE, n25, o25);
1752        this.nodeIdList.splice(this.nodeIdList.indexOf(m25), 1);
1753        this.listNodeDataSource.lastIndex = -1;
1754    }
1755
1756    modifyNode() {
1757        let l25 = this.listNodeDataSource.getClickNodeId();
1758        this.listNodeDataSource.setItemVisibilityOnEdit(l25, MenuOperation.MODIFY_NODE);
1759    }
1760
1761    add(f25) {
1762        let g25 = this.listNodeDataSource.getClickNodeId();
1763        if (g25 === this.listNodeDataSource.ROOT_NODE_ID || !this.listNodeDataSource.getIsFolder(g25)) {
1764            return;
1765        }
1766        let h25 = this.listNodeDataSource.getNewNodeParam(g25);
1767        this.nodeIdList.push(this.nodeIdList[this.nodeIdList.length - 1] + 1);
1768        let i25 = this.nodeIdList[this.nodeIdList.length - 1];
1769        let j25 = this.listNodeDataSource.addNode(g25, i25, {
1770            isFolder: h25.isFolder,
1771            icon: h25.icon,
1772            symbolIconStyle: h25.symbolIconStyle,
1773            selectedIcon: h25.selectedIcon,
1774            symbolSelectedIconStyle: h25.symbolSelectedIconStyle,
1775            editIcon: h25.editIcon,
1776            symbolEditIconStyle: h25.symbolEditIconStyle,
1777            primaryTitle: '新建文件夹',
1778            container: h25.container,
1779            secondaryTitle: h25.secondaryTitle,
1780        }, f25);
1781        if (!j25) {
1782            return;
1783        }
1784        this.listNodeDataSource.refreshData(MenuOperation.ADD_NODE, g25, [i25]);
1785        this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false,
1786            this.listNodeDataSource.getLastIndex());
1787        this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(),
1788            MenuOperation.COMMIT_NODE);
1789        this.listNodeDataSource.listNode[this.listNodeDataSource.getLastIndex()]
1790            .setFontColor(this.treeViewTheme.primaryTitleFontColor);
1791        let k25 = this.listNodeDataSource.findIndex(i25);
1792        this.listNodeDataSource.setClickIndex(k25);
1793        this.listNodeDataSource.handleEvent(Event.TOUCH_UP, k25);
1794    }
1795
1796    addNode(b25) {
1797        if (b25 === undefined) {
1798            this.add(this.initBuild);
1799            return this;
1800        } else {
1801            for (let e25 = 0; e25 < this.nodeIdList.length; e25++) {
1802                if (b25.currentNodeId === this.nodeIdList[e25].valueOf()) {
1803                    throw new Error('ListTreeNode[addNode]: ' +
1804                        'The parameters of the new node cannot contain the same currentNodeId.');
1805                    return this;
1806                }
1807            }
1808            let c25 = false;
1809            if (b25.primaryTitle !== undefined &&
1810                !this.listNodeDataSource.checkMainTitleIsValid(b25.primaryTitle.toString())) {
1811                throw new Error('ListTreeNode[addNode]: ' +
1812                    'The directory name cannot contain the following characters\ /: *? " < > | orexceedsthemaximumlength.');
1813                return this;
1814            }
1815            if (b25.primaryTitle === null && b25.icon === null && b25.symbolIconStyle === null) {
1816                throw new Error('ListTreeNode[addNode]: ' +
1817                    'The icon|symbolIconStyle and directory name cannot be empty at the same time.');
1818                return this;
1819            }
1820            if (b25.currentNodeId === this.ROOT_NODE_ID || b25.currentNodeId === null) {
1821                throw new Error('ListTreeNode[addNode]: currentNodeId can not be -1 or null.');
1822                return this;
1823            }
1824            if (b25.currentNodeId !== undefined) {
1825                this.nodeIdList.push(b25.currentNodeId);
1826            }
1827            if (b25.parentNodeId !== undefined) {
1828                if (b25.currentNodeId !== undefined) {
1829                    c25 =
1830                        this.listNodeDataSource.addNode(b25.parentNodeId, b25.currentNodeId, b25, this.initBuild);
1831                }
1832            }
1833            if (!c25) {
1834                return this;
1835            }
1836            if (!this.initBuild && b25.parentNodeId !== undefined) {
1837                let d25 = this.nodeIdList[this.nodeIdList.length - 1];
1838                this.listNodeDataSource.refreshData(MenuOperation.ADD_NODE, b25.parentNodeId, [d25]);
1839            }
1840            return this;
1841        }
1842    }
1843
1844    refreshNode(y24, z24, a25) {
1845        this.listNodeDataSource.setNodeSubtitlePara(y24, z24, a25);
1846    }
1847
1848    buildDone() {
1849        this.listNodeDataSource.initSection();
1850        this.listNodeDataSource.delayInit();
1851        this.listNodeDataSource.updateAllChildNum();
1852        delaySortNodeIdList(this.nodeIdList);
1853        this.initBuild = false;
1854    }
1855}
1856
1857class BasicDataSource {
1858    constructor() {
1859        this.listeners = [];
1860    }
1861
1862    totalCount() {
1863        return 0;
1864    }
1865
1866    getData(x24) {
1867        return undefined;
1868    }
1869
1870    registerDataChangeListener(w24) {
1871        if (this.listeners.indexOf(w24) < 0) {
1872            this.listeners.push(w24);
1873        }
1874    }
1875
1876    unregisterDataChangeListener(u24) {
1877        const v24 = this.listeners.indexOf(u24);
1878        if (v24 >= 0) {
1879            this.listeners.splice(v24, 1);
1880        }
1881    }
1882
1883    notifyDataReload() {
1884        this.listeners.forEach(t24 => {
1885            t24.onDataReloaded();
1886        });
1887    }
1888
1889    notifyDataAdd(p24) {
1890        this.listeners.forEach(r24 => {
1891            r24.onDataAdd(p24);
1892        });
1893    }
1894
1895    notifyDataChange(m24) {
1896        if (m24 === undefined) {
1897            return;
1898        }
1899        this.listeners.forEach(o24 => {
1900            o24.onDataChange(m24);
1901        });
1902    }
1903
1904    notifyDataDelete(j24) {
1905        this.listeners.forEach(l24 => {
1906            l24.onDataDelete(j24);
1907        });
1908    }
1909
1910    notifyDataMove(f24, g24) {
1911        this.listeners.forEach(i24 => {
1912            i24.onDataMove(f24, g24);
1913        });
1914    }
1915}
1916
1917function delayUpdateParentChildNum(x23, y23, z23, a24) {
1918    let b24 = setTimeout(() => {
1919        a24.forEach((e24) => {
1920            updateParentChildNumHandler(e24, z23, x23, y23);
1921        });
1922        clearTimeout(b24);
1923    }, DELAY_TIME);
1924}
1925
1926function updateParentChildNumHandler(r23, s23, t23, u23) {
1927    let v23 = r23;
1928    while (v23 >= 0) {
1929        if (s23.has(v23)) {
1930            let w23 = s23.get(v23);
1931            w23.getChildNodeInfo().allChildNum =
1932                t23 ? w23.getChildNodeInfo().allChildNum + u23 : w23.getChildNodeInfo().allChildNum - u23;
1933            v23 = w23.parentNodeId;
1934        } else {
1935            hilog.error(LOG_CODE, TAG, 'updateParentChildNumHandler: parent node not found');
1936            break;
1937        }
1938    }
1939}
1940
1941function delaySortNodeIdList(l23) {
1942    let m23 = setTimeout(() => {
1943        l23.sort((p23, q23) => p23 - q23);
1944        clearTimeout(m23);
1945    }, DELAY_TIME);
1946}
1947
1948class ListNodeDataSource extends BasicDataSource {
1949    constructor() {
1950        super();
1951        this.ROOT_NODE_ID = -1;
1952        this._root = new NodeItem(emptyNodeInfo);
1953        this.maxNodeLevel = 50;
1954        this.MAX_CN_LENGTH = 254;
1955        this.MAX_EN_LENGTH = 255;
1956        this.INITIAL_INVALID_VALUE = -1;
1957        this.listNode = [];
1958        this.loadedListNode = [];
1959        this.nodeIdNodeItemMap = new Map();
1960        this.nodeIdNodeParamMap = new Map();
1961        this.lastIndex = -1;
1962        this.thisIndex = -1;
1963        this.modifyNodeIndex = -1;
1964        this.modifyNodeId = -1;
1965        this.expandAndCollapseInfo = new Map();
1966        this.loadedNodeIdAndIndexMap = new Map();
1967        this.nodeIdAndNodeIndexMap = new Map();
1968        this.isTouchDown = false;
1969        this.appEventBus = TreeListenerManager.getInstance().getTreeListener();
1970        this.isInnerDrag = false;
1971        this.isDrag = false;
1972        this.draggingCurrentNodeId = this.INITIAL_INVALID_VALUE;
1973        this.draggingParentNodeId = this.INITIAL_INVALID_VALUE;
1974        this.currentNodeInfo = null;
1975        this.listItemOpacity = 1;
1976        this.lastPassIndex = this.INITIAL_INVALID_VALUE;
1977        this.lastPassId = this.INITIAL_INVALID_VALUE;
1978        this.thisPassIndex = this.INITIAL_INVALID_VALUE;
1979        this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
1980        this.timeoutExpandId = this.INITIAL_INVALID_VALUE;
1981        this.lastTimeoutExpandId = this.INITIAL_INVALID_VALUE;
1982        this.clearTimeoutExpandId = this.INITIAL_INVALID_VALUE;
1983        this.timeoutHighLightId = this.INITIAL_INVALID_VALUE;
1984        this.lastTimeoutHighLightId = this.INITIAL_INVALID_VALUE;
1985        this.clearTimeoutHighLightId = this.INITIAL_INVALID_VALUE;
1986        this.lastDelayHighLightIndex = this.INITIAL_INVALID_VALUE;
1987        this.lastDelayHighLightId = this.INITIAL_INVALID_VALUE;
1988        this.nodeIdAndSubtitleMap = new Map();
1989        this.flag = Flag.NONE;
1990        this.selectedParentNodeId = this.INITIAL_INVALID_VALUE;
1991        this.selectedParentNodeSubtitle = '';
1992        this.insertNodeSubtitle = '';
1993        this.currentFocusNodeId = this.INITIAL_INVALID_VALUE;
1994        this.lastFocusNodeId = this.INITIAL_INVALID_VALUE;
1995        this.addFocusNodeId = this.INITIAL_INVALID_VALUE;
1996        this.treeViewTheme = TreeViewTheme.getInstance();
1997        this.updateNodeIdList = [];
1998        this.FLAG_LINE = {
1999            flagLineHeight: FLAG_LINE_HEIGHT,
2000            flagLineColor: {
2001                'id': -1,
2002                'type': 10001,
2003                params: ['sys.color.ohos_id_color_emphasize'],
2004                'bundleName': '__harDefaultBundleName__',
2005                'moduleName': '__harDefaultModuleName__',
2006            },
2007            xOffset: X_OFF_SET,
2008            yTopOffset: Y_OFF_SET,
2009            yBottomOffset: Y_BOTTOM_OFF_SET,
2010            yBasePlateOffset: Y_BASE_PLATE_OFF_SET,
2011        };
2012        this.DRAG_POPUP = {
2013            floorConstraintSize: { minWidth: FLOOR_MIN_WIDTH, maxWidth: FLOOR_MAX_WIDTH },
2014            textConstraintSize: {
2015                minWidth1: TEXT_MIN_WIDTH,
2016                maxWidth1: TEXT_MAX_WIDTH,
2017                minWidth2: MIN_WIDTH,
2018                maxWidth2: MAX_WIDTH,
2019            },
2020            padding: {
2021                left: {
2022                    'id': -1,
2023                    'type': 10002,
2024                    params: ['sys.float.padding_level4'],
2025                    'bundleName': '__harDefaultBundleName__',
2026                    'moduleName': '__harDefaultModuleName__',
2027                },
2028                right: {
2029                    'id': -1,
2030                    'type': 10002,
2031                    params: ['sys.float.padding_level4'],
2032                    'bundleName': '__harDefaultBundleName__',
2033                    'moduleName': '__harDefaultModuleName__',
2034                }
2035            },
2036            backgroundColor: COLOR_IMAGE_EDIT,
2037            height: GRAG_POP_UP_HEIGHT,
2038            shadow: {
2039                radius: {
2040                    'id': -1,
2041                    'type': 10002,
2042                    params: ['sys.float.ohos_id_default_shadow_m'],
2043                    'bundleName': '__harDefaultBundleName__',
2044                    'moduleName': '__harDefaultModuleName__',
2045                },
2046                color: SHADOW_COLOR,
2047                offsetX: 0,
2048                offsetY: SHADOW_OFFSETY,
2049            },
2050            borderRadius: {
2051                'id': -1,
2052                'type': 10002,
2053                params: ['sys.float.ohos_id_corner_radius_default_s'],
2054                'bundleName': '__harDefaultBundleName__',
2055                'moduleName': '__harDefaultModuleName__',
2056            },
2057            fontColor: this.treeViewTheme.primaryTitleFontColor,
2058            fontSize: {
2059                'id': -1,
2060                'type': 10002,
2061                params: ['sys.float.ohos_id_text_size_body1'],
2062                'bundleName': '__harDefaultBundleName__',
2063                'moduleName': '__harDefaultModuleName__',
2064            },
2065            fontWeight: FontWeight.Regular,
2066            imageOpacity: {
2067                'id': -1,
2068                'type': 10002,
2069                params: ['sys.float.ohos_id_alpha_content_fourth'],
2070                'bundleName': '__harDefaultBundleName__',
2071                'moduleName': '__harDefaultModuleName__',
2072            }
2073        };
2074        this.subTitle = {
2075            normalFontColor: this.treeViewTheme.secondaryTitleFontColor,
2076            highLightFontColor: {
2077                'id': -1,
2078                'type': 10001,
2079                params: ['sys.color.ohos_id_color_primary_contrary'],
2080                'bundleName': '__harDefaultBundleName__',
2081                'moduleName': '__harDefaultModuleName__',
2082            },
2083            fontSize: {
2084                'id': -1,
2085                'type': 10002,
2086                params: ['sys.float.ohos_id_text_size_body2'],
2087                'bundleName': '__harDefaultBundleName__',
2088                'moduleName': '__harDefaultModuleName__',
2089            },
2090            fontWeight: FontWeight.Regular,
2091            margin: {
2092                left: {
2093                    'id': -1,
2094                    'type': 10002,
2095                    params: ['sys.float.padding_level2'],
2096                    'bundleName': '__harDefaultBundleName__',
2097                    'moduleName': '__harDefaultModuleName__',
2098                },
2099                right: {
2100                    'id': -1,
2101                    'type': 10002,
2102                    params: ['sys.float.padding_level12'],
2103                    'bundleName': '__harDefaultBundleName__',
2104                    'moduleName': '__harDefaultModuleName__',
2105                }
2106            }
2107        };
2108        this._root.nodeLevel = -1;
2109        this.nodeIdNodeItemMap.set(-1, this._root);
2110        this.nodeIdNodeParamMap.set(-1, emptyNodeInfo);
2111    }
2112
2113    checkIndex(k23) {
2114        if (k23 < 0 || k23 >= this.listNode.length) {
2115            hilog.error(LOG_CODE, TAG, 'check index fail');
2116            return false;
2117        }
2118        return true;
2119    }
2120
2121    changeNodeColor(i23, j23) {
2122        if (!this.checkIndex(i23)) {
2123            return;
2124        }
2125        this.listNode[i23].setNodeColor(j23);
2126        this.listNode[i23].setNodeBorder(false);
2127    }
2128
2129    getNodeColor(h23) {
2130        return this.listNode[h23].getNodeColor();
2131    }
2132
2133    handleFocusEffect(f23, g23) {
2134        if (this.listNode[f23].getNodeIsShow()) {
2135            this.listNode[f23].setNodeBorder(g23);
2136        }
2137    }
2138
2139    setImageSource(c23, d23) {
2140        if (!this.checkIndex(c23)) {
2141            return;
2142        }
2143        let e23 = this.listNode[c23];
2144        e23.setIsSelected(d23 === InteractionStatus.SELECTED ||
2145            d23 === InteractionStatus.EDIT || d23 === InteractionStatus.FINISH_EDIT);
2146        if (e23.getNodeItem().mainTitleNode !== null && d23 !== InteractionStatus.DRAG_INSERT &&
2147            d23 !== InteractionStatus.FINISH_DRAG_INSERT) {
2148            e23.getNodeItem().mainTitleNode?.setMainTitleSelected(d23 === InteractionStatus.SELECTED ||
2149                d23 === InteractionStatus.FINISH_EDIT);
2150        }
2151        if (e23.getNodeItem().imageNode !== null) {
2152            e23.getNodeItem().imageNode?.setImageSource(d23);
2153        }
2154    }
2155
2156    setImageCollapseSource(z22, a23) {
2157        let b23 = this.listNode[z22];
2158        if (b23.getNodeItem().imageCollapse !== undefined) {
2159            b23.getNodeItem().imageCollapse = CollapseImageNodeFlyweightFactory.getCollapseImageNode(a23,
2160                this.expandAndCollapseInfo.get(b23.getNodeCurrentNodeId()), b23.getNodeItem().imageCollapse?.type);
2161        }
2162    }
2163
2164    clearLastIndexStatus() {
2165        if (!this.checkIndex(this.lastIndex)) {
2166            return;
2167        }
2168        this.setImageSource(this.lastIndex, InteractionStatus.NORMAL);
2169        this.changeNodeColor(this.lastIndex, this.listNode[this.lastIndex].getNodeStatus().normal);
2170        this.handleFocusEffect(this.lastIndex, false);
2171        this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[this.lastIndex].getNodeCurrentNodeId()));
2172    }
2173
2174    loadedListNodeFunction() {
2175        let x22 = 0;
2176        this.loadedNodeIdAndIndexMap.clear();
2177        this.nodeIdAndNodeIndexMap.clear();
2178        this.loadedListNode.splice(0, this.loadedListNode.length);
2179        for (let y22 = 0; y22 < this.listNode.length; y22++) {
2180            this.nodeIdAndNodeIndexMap.set(this.listNode[y22].getNodeCurrentNodeId(), y22);
2181            if (this.listNode[y22].getNodeIsShow()) {
2182                this.loadedNodeIdAndIndexMap.set(this.listNode[y22].getNodeCurrentNodeId(), x22++);
2183                this.loadedListNode.push(this.listNode[y22]);
2184            }
2185        }
2186    }
2187
2188    changeNodeStatus(u22) {
2189        if (u22 >= this.listNode.length) {
2190            hilog.error(LOG_CODE, TAG, 'changeNodeStatus clickIndex error.');
2191            return;
2192        }
2193        let v22 = u22;
2194        let w22 = this.listNode[u22].getNodeCurrentNodeId();
2195        if (this.expandAndCollapseInfo.get(w22) === NodeStatus.EXPAND) {
2196            this.expandAndCollapseInfo.set(w22, NodeStatus.COLLAPSE);
2197            this.listNode[v22].getNodeItem()
2198                .imageCollapse = CollapseImageNodeFlyweightFactory.changeImageCollapseSource(NodeStatus.COLLAPSE,
2199                this.listNode[v22].getNodeItem().imageCollapse?.isCollapse);
2200        } else if (this.expandAndCollapseInfo.get(w22) === NodeStatus.COLLAPSE) {
2201            this.expandAndCollapseInfo.set(w22, NodeStatus.EXPAND);
2202            this.listNode[v22].getNodeItem()
2203                .imageCollapse = CollapseImageNodeFlyweightFactory.changeImageCollapseSource(NodeStatus.EXPAND,
2204                this.listNode[v22].getNodeItem().imageCollapse?.isCollapse);
2205        }
2206    }
2207
2208    handleExpandAndCollapse(k22, l22) {
2209        if (k22 >= this.listNode.length) {
2210            hilog.error(LOG_CODE, TAG, 'handleExpandAndCollapse clickIndex error.');
2211            return;
2212        }
2213        let m22 = k22;
2214        let n22 = this.listNode[m22].getNodeCurrentNodeId();
2215        if (!this.expandAndCollapseInfo.has(n22)) {
2216            return;
2217        }
2218        let o22 = this.expandAndCollapseInfo.get(n22);
2219        if (this.listNode[m22].getChildNodeInfo().isHasChildNode && o22 === NodeStatus.COLLAPSE) {
2220            for (let t22 = 0; t22 < this.listNode[m22].getChildNodeInfo().allChildNum; t22++) {
2221                if (this.listNode[m22 + 1 + t22] === undefined) {
2222                    return;
2223                }
2224                this.listNode[m22 + 1 + t22].setNodeIsShow(false);
2225                this.listNode[m22 + 1 + t22].setListItemHeight(LIST_ITEM_HEIGHT_NONE);
2226            }
2227            this.loadedListNodeFunction();
2228            this.notifyDataReload();
2229            return;
2230        }
2231        let p22 = new Array(this.listNode[m22].getChildNodeInfo().childNum);
2232        p22[0] = m22 + 1;
2233        let q22 = 1;
2234        while (q22 < this.listNode[m22].getChildNodeInfo().childNum) {
2235            p22[q22] = p22[q22 - 1] + this.listNode[p22[q22 - 1]].getChildNodeInfo().allChildNum + 1;
2236            q22++;
2237        }
2238        if (o22 === NodeStatus.EXPAND) {
2239            for (let r22 = 0; r22 < p22.length; r22++) {
2240                if (this.listNode[p22[r22]] === undefined) {
2241                    return;
2242                }
2243                this.listNode[p22[r22]].setNodeIsShow(true);
2244                this.listNode[p22[r22]].setListItemHeight(LIST_ITEM_HEIGHT);
2245                let s22 = this.listNode[p22[r22]].getNodeCurrentNodeId();
2246                if (this.expandAndCollapseInfo.get(s22) === NodeStatus.EXPAND) {
2247                    this.handleExpandAndCollapse(p22[r22], false);
2248                }
2249            }
2250        }
2251        p22 = null;
2252        if (l22) {
2253            this.loadedListNodeFunction();
2254            this.notifyDataReload();
2255        }
2256    }
2257
2258    updateAllChildNum() {
2259        delayUpdateParentChildNum(true, 1, this.nodeIdNodeItemMap, this.updateNodeIdList);
2260    }
2261
2262    resetData(j22) {
2263        j22.splice(0, j22.length);
2264        this.loadedNodeIdAndIndexMap.clear();
2265        this.loadedListNode.splice(0, this.loadedListNode.length);
2266        this.nodeIdAndNodeIndexMap.clear();
2267        this.nodeIdAndSubtitleMap.clear();
2268    }
2269
2270    initHandler(a22, b22, c22) {
2271        let d22 = 0;
2272        let e22 = 0;
2273        this.resetData(a22);
2274        try {
2275            this.traverseSectionNodeDF((h22) => {
2276                if (h22.getCurrentNodeId() >= 0 && this.nodeIdNodeParamMap.has(h22.getCurrentNodeId())) {
2277                    let i22 = new NodeInfo(h22, this.nodeIdNodeParamMap.get(h22.getCurrentNodeId()));
2278                    i22.addImageCollapse(h22.getChildNodeInfo().isHasChildNode);
2279                    a22.push(i22);
2280                    this.nodeIdAndNodeIndexMap.set(i22.getNodeCurrentNodeId(), e22++);
2281                    d22 = this.nodeDFHandler(i22, d22);
2282                }
2283                return false;
2284            }, this._root, b22, c22);
2285        } catch (f22) {
2286            hilog.error(LOG_CODE, TAG, 'traverseSectionNodeDF function callbacks error.');
2287            this.resetData(a22);
2288        }
2289    }
2290
2291    nodeDFHandler(y21, z21) {
2292        if (y21.getChildNodeInfo().isHasChildNode) {
2293            this.expandAndCollapseInfo.set(y21.getNodeCurrentNodeId(), NodeStatus.COLLAPSE);
2294        }
2295        if (y21.getNodeIsShow()) {
2296            this.loadedNodeIdAndIndexMap.set(y21.getNodeCurrentNodeId(), z21++);
2297            this.loadedListNode.push(y21);
2298        }
2299        if (y21.getIsFolder()) {
2300            if (y21.getNodeInfoData().secondaryTitle !== undefined) {
2301                this.nodeIdAndSubtitleMap.set(y21.getNodeCurrentNodeId(), y21.getNodeInfoData().secondaryTitle);
2302            } else {
2303                this.nodeIdAndSubtitleMap.set(y21.getNodeCurrentNodeId(), '');
2304            }
2305        }
2306        return z21;
2307    }
2308
2309    delayInit() {
2310        let s21 = setTimeout(() => {
2311            let u21 = [];
2312            this.initHandler(u21, 0);
2313            this.listNode.splice(0, this.listNode.length);
2314            this.listNode.push(...u21);
2315            this.listNode.forEach((w21, x21) => {
2316                this.notifyDataDelete(x21);
2317                this.notifyDataAdd(x21);
2318            });
2319            clearTimeout(s21);
2320        }, DELAY_TIME);
2321    }
2322
2323    initSection() {
2324        this.initHandler(this.listNode, 0, 1);
2325    }
2326
2327    setClickIndex(r21) {
2328        this.thisIndex = r21;
2329    }
2330
2331    getClickNodeId() {
2332        if (!this.checkIndex(this.thisIndex)) {
2333            return -1;
2334        }
2335        return this.listNode[this.thisIndex].getNodeCurrentNodeId();
2336    }
2337
2338    expandAndCollapseNode(q21) {
2339        this.changeNodeStatus(q21);
2340        this.handleExpandAndCollapse(q21, true);
2341    }
2342
2343    getIsTouchDown() {
2344        return this.isTouchDown;
2345    }
2346
2347    getLastIndex() {
2348        return this.lastIndex;
2349    }
2350
2351    findIndex(o21) {
2352        let p21 = -1;
2353        if (this.nodeIdAndNodeIndexMap.has(o21)) {
2354            p21 = this.nodeIdAndNodeIndexMap.get(o21);
2355        }
2356        return p21;
2357    }
2358
2359    handleEventDrag(n21) {
2360        if (!this.checkIndex(n21)) {
2361            return;
2362        }
2363        this.setImageSource(n21, InteractionStatus.NORMAL);
2364        this.changeNodeColor(n21, this.listNode[n21].getNodeStatus().normal);
2365        this.handleFocusEffect(n21, false);
2366        this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.listNode[n21].getNodeCurrentNodeId()));
2367    }
2368
2369    handleEvent(l21, m21) {
2370        if (this.isDrag) {
2371            return;
2372        }
2373        if (!this.checkIndex(m21)) {
2374            return;
2375        }
2376        if (l21 === Event.TOUCH_DOWN || l21 === Event.TOUCH_UP || l21 === Event.MOUSE_BUTTON_RIGHT) {
2377            if (m21 !== this.lastIndex) {
2378                this.clearLastIndexStatus();
2379            }
2380        }
2381        this.eventHandler(m21, l21);
2382    }
2383
2384    eventHandler(h21, i21) {
2385        let j21 = this.loadedNodeIdAndIndexMap.get(this.listNode[h21].getNodeCurrentNodeId());
2386        switch (i21) {
2387            case Event.TOUCH_DOWN:
2388                this.isTouchDown = true;
2389                this.changeNodeColor(h21, this.listNode[h21].getNodeStatus().press);
2390                this.notifyDataChange(j21);
2391                break;
2392            case Event.TOUCH_UP: {
2393                this.touchUpHandler(h21, j21);
2394                break;
2395            }
2396            case Event.HOVER:
2397                if (this.getNodeColor(h21) !== this.listNode[h21].getNodeStatus().selected) {
2398                    this.changeNodeColor(h21, this.listNode[h21].getNodeStatus().hover);
2399                    this.notifyDataChange(j21);
2400                }
2401                break;
2402            case Event.HOVER_OVER:
2403                if (this.getNodeColor(h21) !== this.listNode[h21].getNodeStatus().selected) {
2404                    this.changeNodeColor(h21, this.listNode[h21].getNodeStatus().normal);
2405                    this.notifyDataChange(j21);
2406                }
2407                break;
2408            case Event.FOCUS:
2409                this.handleFocusEffect(h21, true);
2410                this.notifyDataChange(j21);
2411                break;
2412            case Event.BLUR:
2413                this.handleFocusEffect(h21, false);
2414                this.notifyDataChange(j21);
2415                break;
2416            case Event.MOUSE_BUTTON_RIGHT:
2417                this.lastIndex = h21;
2418                this.finishEditing();
2419                break;
2420            case Event.DRAG:
2421                this.isTouchDown = false;
2422                let k21 = this.listNode[h21];
2423                this.setImageSource(h21, InteractionStatus.SELECTED);
2424                this.lastIndex = h21;
2425                this.changeNodeColor(h21, k21.getNodeStatus().selected);
2426                this.notifyDataChange(j21);
2427                break;
2428            default:
2429                break;
2430        }
2431    }
2432
2433    touchUpHandler(e21, f21) {
2434        if (this.isInnerDrag) {
2435            this.isInnerDrag = false;
2436        }
2437        this.isTouchDown = false;
2438        let g21 = this.listNode[e21];
2439        this.setImageSource(e21, InteractionStatus.SELECTED);
2440        g21.setFontColor(this.treeViewTheme.primaryTitleFontColor);
2441        this.lastIndex = e21;
2442        this.changeNodeColor(e21, g21.getNodeStatus().selected);
2443        this.notifyDataChange(f21);
2444    }
2445
2446    notificationNodeInfo(v20, w20) {
2447        if (w20 === MenuOperation.MODIFY_NODE) {
2448            let c21 = this.listNode[this.modifyNodeIndex];
2449            let d21 = {
2450                currentNodeId: c21?.getNodeCurrentNodeId(),
2451                parentNodeId: c21?.getNodeParentNodeId(),
2452            };
2453            this.appEventBus.emit(TreeListenType.NODE_MODIFY, d21);
2454        } else if (w20 === MenuOperation.ADD_NODE) {
2455            let x20 = this.listNode[v20];
2456            if (x20 === undefined) {
2457                return;
2458            }
2459            let y20 = (x20.getNodeItem().imageNode !== undefined) ?
2460                x20.getNodeItem().imageNode?.source : undefined;
2461            let z20 = (x20.getNodeItem().imageNode !== undefined) ?
2462                x20.getNodeItem().imageNode?.selectedSource : undefined;
2463            let a21 = (x20.getNodeItem().imageNode !== undefined) ?
2464                x20.getNodeItem().imageNode?.editSource : undefined;
2465            let b21 = {
2466                currentNodeId: x20?.getNodeCurrentNodeId(),
2467                parentNodeId: x20?.getNodeParentNodeId(),
2468            };
2469            this.appEventBus.emit(TreeListenType.NODE_ADD, b21);
2470        }
2471    }
2472
2473    finishEditing() {
2474        if (this.modifyNodeIndex !== -1) {
2475            this.setImageSource(this.modifyNodeIndex, InteractionStatus.FINISH_EDIT);
2476            this.setImageCollapseSource(this.modifyNodeIndex, InteractionStatus.FINISH_EDIT);
2477            this.listNode[this.modifyNodeIndex].setIsModify(false);
2478            this.listNode[this.modifyNodeIndex].setTitleAndInputTextStatus(false);
2479            this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation);
2480            this.notifyDataChange(this.modifyNodeIndex);
2481        }
2482    }
2483
2484    setItemVisibilityOnEdit(p20, q20) {
2485        let r20 = -1;
2486        if (p20 === -1) {
2487            return;
2488        }
2489        if (q20 === MenuOperation.MODIFY_NODE) {
2490            for (let u20 = 0; u20 < this.listNode.length; u20++) {
2491                if (this.listNode[u20]?.getNodeCurrentNodeId() === p20) {
2492                    r20 = u20;
2493                    break;
2494                }
2495            }
2496            let t20 = this.listNode[r20];
2497            if (t20 === undefined) {
2498                return;
2499            }
2500            t20.setIsModify(true);
2501            if (t20.getNodeItem().mainTitleNode === null) {
2502                return;
2503            }
2504            this.currentOperation = MenuOperation.MODIFY_NODE;
2505            t20.setTitleAndInputTextStatus(true);
2506            this.setImageSource(r20, InteractionStatus.EDIT);
2507            this.setImageCollapseSource(r20, InteractionStatus.EDIT);
2508            this.modifyNodeIndex = r20;
2509            if (t20.getNodeItem().inputText) {
2510                if (t20.getNodeItem().imageCollapse !== null) {
2511                    t20.getNodeItem().inputText.rightMargin = {
2512                        'id': -1,
2513                        'type': 10002,
2514                        params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
2515                        'bundleName': '__harDefaultBundleName__',
2516                        'moduleName': '__harDefaultModuleName__',
2517                    };
2518                } else {
2519                    t20.getNodeItem().inputText.rightMargin = {
2520                        'id': -1,
2521                        'type': 10002,
2522                        params: ['sys.float.ohos_id_elements_margin_horizontal_m'],
2523                        'bundleName': '__harDefaultBundleName__',
2524                        'moduleName': '__harDefaultModuleName__',
2525                    };
2526                }
2527            }
2528            this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(p20));
2529        }
2530        r20 = p20;
2531        if (q20 === MenuOperation.COMMIT_NODE) {
2532            let s20 = this.listNode[r20];
2533            if (s20 === undefined) {
2534                return;
2535            }
2536            s20.setTitleAndInputTextStatus(false);
2537            s20.setIsModify(false);
2538            this.setImageSource(r20, InteractionStatus.FINISH_EDIT);
2539            this.setImageCollapseSource(r20, InteractionStatus.FINISH_EDIT);
2540            this.notificationNodeInfo(this.modifyNodeIndex, this.currentOperation);
2541            this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(s20?.getNodeCurrentNodeId()));
2542        }
2543    }
2544
2545    setPopUpInfo(j20, k20, l20, m20) {
2546        if (!this.checkIndex(m20)) {
2547            return;
2548        }
2549        let n20 = this.listNode[m20];
2550        if (n20 === undefined) {
2551            return;
2552        }
2553        n20.setPopUpIsShow(l20);
2554        let o20 = this.loadedNodeIdAndIndexMap.get(n20.getNodeCurrentNodeId());
2555        if (!l20) {
2556            this.notifyDataChange(o20);
2557            return;
2558        }
2559        if (j20 === PopUpType.HINTS) {
2560            if (n20.getNodeItem().mainTitleNode !== null) {
2561                n20.setPopUpText(n20.getNodeItem().mainTitleNode?.title);
2562            } else {
2563                n20.setPopUpText('');
2564                n20.setPopUpIsShow(false);
2565            }
2566            n20.setPopUpEnableArrow(false);
2567            n20.setPopUpColor({
2568                'id': -1,
2569                'type': 10001,
2570                params: ['sys.color.ohos_id_color_background'],
2571                'bundleName': '__harDefaultBundleName__',
2572                'moduleName': '__harDefaultModuleName__',
2573            });
2574            n20.setPopUpTextColor(this.treeViewTheme.secondaryTitleFontColor);
2575        } else if (j20 === PopUpType.WARNINGS) {
2576            if (n20.getNodeItem().inputText !== null) {
2577                if (k20 === InputError.INVALID_ERROR) {
2578                    n20.setPopUpText('invalid error');
2579                } else if (k20 === InputError.LENGTH_ERROR) {
2580                    n20.setPopUpText('length error');
2581                }
2582                n20.setPopUpEnableArrow(true);
2583                n20.setPopUpColor({
2584                    'id': -1,
2585                    'type': 10001,
2586                    params: ['sys.color.ohos_id_color_help_tip_bg'],
2587                    'bundleName': '__harDefaultBundleName__',
2588                    'moduleName': '__harDefaultModuleName__',
2589                });
2590                n20.setPopUpTextColor({
2591                    'id': -1,
2592                    'type': 10001,
2593                    params: ['sys.color.ohos_id_color_text_hint_contrary'],
2594                    'bundleName': '__harDefaultBundleName__',
2595                    'moduleName': '__harDefaultModuleName__',
2596                });
2597            }
2598        }
2599        this.notifyDataChange(o20);
2600    }
2601
2602    setShowPopUpTimeout(g20, h20) {
2603        if (!this.checkIndex(h20)) {
2604            return;
2605        }
2606        if (this.listNode[h20].getNodeItem().mainTitleNode !== null) {
2607            this.listNode[h20].getNodeItem().mainTitleNode.popUpTimeout = g20;
2608        }
2609        let i20 = this.loadedNodeIdAndIndexMap.get(this.listNode[h20].getNodeCurrentNodeId());
2610        this.notifyDataChange(i20);
2611    }
2612
2613    setMainTitleNameOnEdit(e20, f20) {
2614        this.modifyNodeIndex = e20;
2615        if (this.listNode[e20].getNodeItem().mainTitleNode !== null) {
2616            this.listNode[e20].getNodeItem().mainTitleNode.title = f20;
2617        }
2618    }
2619
2620    totalCount() {
2621        return this.loadedNodeIdAndIndexMap.size;
2622    }
2623
2624    getData(d20) {
2625        if (d20 < 0 || d20 >= this.loadedListNode.length) {
2626            return undefined;
2627        }
2628        return this.loadedListNode[d20];
2629    }
2630
2631    addData(b20, c20) {
2632        if (!this.checkIndex(b20)) {
2633            return;
2634        }
2635        this.listNode.splice(b20, 0, c20);
2636        this.nodeIdAndNodeIndexMap.set(c20.getNodeCurrentNodeId(), b20);
2637        this.loadedListNodeFunction();
2638        this.notifyDataAdd(b20);
2639    }
2640
2641    pushData(a20) {
2642        this.listNode.push(a20);
2643        this.nodeIdAndNodeIndexMap.set(a20.getNodeCurrentNodeId(), this.listNode.length);
2644        this.loadedListNodeFunction();
2645        this.notifyDataAdd(this.listNode.length - 1);
2646    }
2647
2648    setIsInnerDrag(z19) {
2649        this.isInnerDrag = z19;
2650    }
2651
2652    getIsInnerDrag() {
2653        return this.isInnerDrag;
2654    }
2655
2656    setIsDrag(y19) {
2657        this.isDrag = y19;
2658    }
2659
2660    getIsDrag() {
2661        return this.isDrag;
2662    }
2663
2664    setCurrentNodeInfo(x19) {
2665        if (x19 === undefined) {
2666            return;
2667        }
2668        this.currentNodeInfo = x19;
2669    }
2670
2671    getCurrentNodeInfo() {
2672        return this.currentNodeInfo;
2673    }
2674
2675    setDraggingParentNodeId(w19) {
2676        if (w19 === undefined) {
2677            return;
2678        }
2679        this.draggingParentNodeId = w19;
2680    }
2681
2682    getDraggingParentNodeId() {
2683        return this.draggingParentNodeId;
2684    }
2685
2686    getDraggingCurrentNodeId() {
2687        return this.draggingCurrentNodeId;
2688    }
2689
2690    setDraggingCurrentNodeId(v19) {
2691        if (v19 === undefined) {
2692            return;
2693        }
2694        this.draggingCurrentNodeId = v19;
2695    }
2696
2697    setListItemOpacity(u19) {
2698        this.listItemOpacity = u19;
2699    }
2700
2701    getListItemOpacity(t19) {
2702        return t19.getNodeCurrentNodeId() === this.getDraggingCurrentNodeId() ? this.listItemOpacity : 1;
2703    }
2704
2705    getDragPopupPara() {
2706        return this.DRAG_POPUP;
2707    }
2708
2709    setLastPassIndex(s19) {
2710        this.lastPassIndex = s19;
2711    }
2712
2713    getLastPassIndex() {
2714        return this.lastPassIndex;
2715    }
2716
2717    getIsParentOfInsertNode(o19) {
2718        if (this.currentNodeInfo === null || o19 === undefined) {
2719            return false;
2720        }
2721        let p19 = this.currentNodeInfo.getNodeInfoNode();
2722        let q19 = p19.currentNodeId;
2723        let r19 = this.nodeIdNodeItemMap.get(o19)?.parentNodeId;
2724        while (r19 !== undefined && r19 !== -1) {
2725            if (q19 === r19) {
2726                return true;
2727            } else {
2728                r19 = this.nodeIdNodeItemMap.get(r19)?.parentNodeId;
2729            }
2730        }
2731        return false;
2732    }
2733
2734    setPassIndex(n19) {
2735        this.thisPassIndex = n19;
2736    }
2737
2738    getPassIndex() {
2739        return this.thisPassIndex;
2740    }
2741
2742    clearTimeOutAboutDelayHighLightAndExpand(i19) {
2743        if (this.lastPassId !== this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
2744            let k19 = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
2745            this.listNode.forEach((m19) => {
2746                if (m19.getNodeCurrentNodeId() === this.lastPassId) {
2747                    m19.setCanShowFlagLine(false);
2748                    return;
2749                }
2750            });
2751            this.notifyDataChange(k19);
2752        }
2753        if ((this.lastTimeoutHighLightId !== this.INITIAL_INVALID_VALUE &&
2754            this.clearTimeoutHighLightId !== this.lastTimeoutHighLightId)) {
2755            clearTimeout(this.lastTimeoutHighLightId);
2756            if (this.lastDelayHighLightIndex !== this.INITIAL_INVALID_VALUE) {
2757                this.clearHighLight(this.lastDelayHighLightIndex);
2758                let j19 = this.loadedNodeIdAndIndexMap
2759                    .get(this.listNode[this.lastDelayHighLightIndex].getNodeCurrentNodeId());
2760                this.notifyDataChange(j19);
2761            }
2762            this.clearTimeoutHighLightId = this.lastTimeoutHighLightId;
2763        }
2764        this.lastTimeoutHighLightId = this.timeoutHighLightId;
2765        this.lastDelayHighLightIndex = i19;
2766        if ((this.lastTimeoutExpandId !== this.INITIAL_INVALID_VALUE &&
2767            this.clearTimeoutExpandId !== this.lastTimeoutExpandId)) {
2768            clearTimeout(this.lastTimeoutExpandId);
2769            this.clearTimeoutExpandId = this.lastTimeoutExpandId;
2770        }
2771        this.lastTimeoutExpandId = this.timeoutExpandId;
2772        this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
2773    }
2774
2775    clearHighLight(h19) {
2776        if (!this.checkIndex(h19)) {
2777            return;
2778        }
2779        this.changeNodeColor(h19, this.listNode[h19].getNodeStatus().normal);
2780        this.changeNodeHighLightColor(h19, false);
2781        this.setImageSource(h19, InteractionStatus.FINISH_DRAG_INSERT);
2782        this.setImageCollapseSource(h19, InteractionStatus.FINISH_DRAG_INSERT);
2783        this.listNode[h19].setIsHighLight(false);
2784    }
2785
2786    changeNodeHighLightColor(f19, g19) {
2787        if (this.listNode[f19].getNodeItem().mainTitleNode && this.listNode[f19].getIsShowTitle()) {
2788            this.listNode[f19].getNodeItem().mainTitleNode?.setMainTitleHighLight(g19);
2789        }
2790    }
2791
2792    getAccessibleTitle(x18) {
2793        let y18 = [];
2794        while (x18 !== -1) {
2795            if (x18 === undefined) {
2796                return '';
2797            }
2798            let z18 = this.findParentNodeId(x18);
2799            let a19 = this.nodeIdNodeItemMap.get(z18);
2800            if (a19 === undefined || z18 === undefined) {
2801                return '';
2802            }
2803            let b19 = this.getNodeInfoByNodeItem(a19).getNodeInfoData()?.primaryTitle === undefined
2804                ? '' : this.getNodeInfoByNodeItem(a19).getNodeInfoData().primaryTitle;
2805            let c19 = this.getNodeInfoByNodeItem(a19).getNodeInfoData()?.secondaryTitle === undefined
2806                ? '' : this.getNodeInfoByNodeItem(a19).getNodeInfoData().secondaryTitle;
2807            let d19 = this.getAccessibleTitleText(b19);
2808            let e19 = this.getAccessibleTitleText(c19);
2809            y18.unshift(`${d19}, ${e19}`);
2810            x18 = a19.currentNodeId;
2811        }
2812        return y18.join(',');
2813    }
2814
2815    getPlaceAccessibleTitle(i18) {
2816        if (i18 === undefined) {
2817            return '';
2818        }
2819        let j18 = this.findParentNodeId(i18);
2820        if (j18 === -1) {
2821            let r18 = [];
2822            let s18 = this.nodeIdNodeItemMap.get(i18);
2823            if (s18 === undefined || j18 === undefined) {
2824                return '';
2825            }
2826            let t18 = this.getNodeInfoByNodeItem(s18).getNodeInfoData()?.primaryTitle === undefined
2827                ? '' : this.getNodeInfoByNodeItem(s18).getNodeInfoData().primaryTitle;
2828            let u18 = this.getNodeInfoByNodeItem(s18).getNodeInfoData()?.secondaryTitle === undefined
2829                ? '' : this.getNodeInfoByNodeItem(s18).getNodeInfoData().secondaryTitle;
2830            let v18 = this.getAccessibleTitleText(t18);
2831            let w18 = this.getAccessibleTitleText(u18);
2832            r18.unshift(`${v18}, ${w18}`);
2833            return r18.join(',');
2834        } else {
2835            let k18 = [];
2836            let v1 = this.nodeIdNodeItemMap.get(i18);
2837            if (v1 === undefined || j18 === undefined) {
2838                return '';
2839            }
2840            let w1 = this.getNodeInfoByNodeItem(v1).getNodeInfoData()?.primaryTitle === undefined
2841                ? '' : this.getNodeInfoByNodeItem(v1).getNodeInfoData().primaryTitle;
2842            let x1 = this.getNodeInfoByNodeItem(v1).getNodeInfoData()?.secondaryTitle === undefined
2843                ? '' : this.getNodeInfoByNodeItem(v1).getNodeInfoData().secondaryTitle;
2844            let y1 = this.getAccessibleTitleText(w1);
2845            let z1 = this.getAccessibleTitleText(x1);
2846            k18.unshift(`${y1}, ${z1}`);
2847            while (i18 !== -1) {
2848                if (i18 === undefined) {
2849                    return '';
2850                }
2851                let b2 = this.findParentNodeId(i18);
2852                let c2 = this.nodeIdNodeItemMap.get(b2);
2853                if (c2 === undefined || b2 === undefined) {
2854                    return '';
2855                }
2856                let d2 = this.getNodeInfoByNodeItem(c2).getNodeInfoData()?.primaryTitle === undefined
2857                    ? '' : this.getNodeInfoByNodeItem(c2).getNodeInfoData().primaryTitle;
2858                let e2 = this.getNodeInfoByNodeItem(c2).getNodeInfoData()?.secondaryTitle === undefined
2859                    ? '' : this.getNodeInfoByNodeItem(c2).getNodeInfoData().secondaryTitle;
2860                let f2 = this.getAccessibleTitleText(d2);
2861                let g2 = this.getAccessibleTitleText(e2);
2862                k18.unshift(`${f2}, ${g2}`);
2863                i18 = c2.currentNodeId;
2864            }
2865            return k18.join(',');
2866        }
2867    }
2868
2869    getDraggingAccessible(y17, z17, a18) {
2870        this.getAccessibleTitle(a18);
2871        if (z17 === undefined || a18 === undefined) {
2872            return;
2873        }
2874        let b18 = this.findParentNodeId(a18);
2875        let c18 = y17.indexOf(a18) + 2;
2876        let d18 = this.getClickNodeChildrenInfo(b18);
2877        let e18 = d18.map(h18 => h18.itemId);
2878        let f18 = e18.indexOf(a18) + 2;
2879        if (b18 === -1 && this.getExpandAndCollapseInfo(z17) === NodeStatus.COLLAPSE ||
2880            b18 === -1 && this.getExpandAndCollapseInfo(z17) === undefined) {
2881            this.sendAccessibility(this.getStringByName('treeview_accessibility_move_node_parent', c18));
2882        } else if (this.getExpandAndCollapseInfo(z17) === NodeStatus.EXPAND) {
2883            this.sendAccessibility(this.getStringByName('treeview_accessibility_move_node_child',
2884                this.getAccessibleTitle(a18), 1));
2885        } else if (b18 !== -1) {
2886            this.sendAccessibility(this.getStringByName('treeview_accessibility_move_node_child',
2887                this.getAccessibleTitle(a18), f18));
2888        }
2889    }
2890
2891    getStringByName(v17, ...w17) {
2892        if (v17) {
2893            try {
2894                return getContext()?.resourceManager.getStringByNameSync(v17, ...w17);
2895            } catch (x17) {
2896                console.error(`Ace SegmentButton getAccessibilityDescription, error: ${x17.toString()}`);
2897            }
2898        }
2899        return '';
2900    }
2901
2902    sendAccessibility(t17) {
2903        let u17 = ({
2904            type: 'announceForAccessibility',
2905            bundleName: getContext()?.abilityInfo?.bundleName,
2906            triggerAction: 'common',
2907            textAnnouncedForAccessibility: t17
2908        });
2909        accessibility.sendAccessibilityEvent(u17);
2910    }
2911
2912    getAccessibleTitleText(o17) {
2913        let p17 = '';
2914        try {
2915            if (typeof o17 === 'string') {
2916                p17 = o17;
2917            } else {
2918                p17 = getContext()?.resourceManager?.getStringSync(o17?.id);
2919            }
2920        } catch (q17) {
2921            let r17 = q17.code;
2922            let s17 = q17.message;
2923            hilog.error(0x3900, 'Ace', `treeView getAccessibleTitleText error, code: ${r17}, message: ${s17}`);
2924        }
2925        return p17;
2926    }
2927
2928    setVisibility(z16, a17, b17, c17) {
2929        let d17 = (this.thisPassIndex !== a17 || this.flag !== z16) ? true : false;
2930        this.thisPassIndex = a17;
2931        if ((d17 || b17) && this.isInnerDrag) {
2932            this.flag = z16;
2933            let e17 = this.getData(a17)?.getNodeCurrentNodeId();
2934            let f17 = this.getData(a17)?.getNodeLevel();
2935            if (e17 !== undefined) {
2936                f17 = (this.expandAndCollapseInfo.get(e17) === NodeStatus.EXPAND &&
2937                    this.flag === Flag.DOWN_FLAG) ? (f17 ? f17 + 1 : undefined) : f17;
2938                if (this.lastPassId !== this.INITIAL_INVALID_VALUE &&
2939                this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
2940                    let l17 = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
2941                    this.listNode.forEach((n17) => {
2942                        if (n17.getNodeCurrentNodeId() === this.lastPassId) {
2943                            n17.setCanShowFlagLine(false);
2944                        }
2945                    });
2946                    this.notifyDataChange(l17);
2947                }
2948                let g17 = this.getData(a17 - 1)?.getNodeCurrentNodeId();
2949                let h17 = this.getData(a17 + 2)?.getNodeCurrentNodeId();
2950                let i17 = this.getData(a17 + 1)?.getNodeCurrentNodeId();
2951                let j17 = this.nodeIdNodeItemMap.get(i17);
2952                if (this.flag === Flag.DOWN_FLAG && a17 < this.totalCount() - 1) {
2953                    this.getData(a17)?.setCanShowFlagLine(false);
2954                    this.getData(a17 + 1)?.setCanShowFlagLine(true);
2955                    this.getData(a17)?.setCanShowBottomFlagLine(false);
2956                    this.getData(a17 + 1)?.setFlagLineLeftMargin(f17);
2957                    this.notifyDataChange(a17);
2958                    this.notifyDataChange(a17 + 1);
2959                    this.lastPassId = this.getData(a17 + 1)?.getNodeCurrentNodeId();
2960                    let k17 = this.nodeIdNodeItemMap.get(i17);
2961                    if (!k17?.childNodeInfo.isHasChildNode) {
2962                        this.getDraggingAccessible(c17, i17, i17);
2963                    } else {
2964                        this.getDraggingAccessible(c17, i17, h17);
2965                    }
2966                } else if (this.flag === Flag.UP_FLAG && a17 < this.totalCount() - 1) {
2967                    this.getData(a17)?.setCanShowFlagLine(true);
2968                    this.getData(a17 + 1)?.setCanShowFlagLine(false);
2969                    this.getData(a17)?.setCanShowBottomFlagLine(false);
2970                    this.getData(a17)?.setFlagLineLeftMargin(f17);
2971                    this.notifyDataChange(a17);
2972                    this.notifyDataChange(a17 + 1);
2973                    this.lastPassId = this.getData(a17)?.getNodeCurrentNodeId();
2974                    if (j17?.childNodeInfo.isHasChildNode && j17?.parentNodeId !== -1) {
2975                        this.getDraggingAccessible(c17, i17, i17);
2976                    } else if (j17?.childNodeInfo.isHasChildNode && j17?.parentNodeId === -1) {
2977                        this.getDraggingAccessible(c17, g17, i17);
2978                    }
2979                } else if (a17 >= this.totalCount() - 1) {
2980                    if (this.flag === Flag.DOWN_FLAG) {
2981                        this.getData(a17)?.setCanShowFlagLine(false);
2982                        this.getData(a17)?.setCanShowBottomFlagLine(true);
2983                    } else {
2984                        this.getData(a17)?.setCanShowFlagLine(true);
2985                        this.getData(a17)?.setCanShowBottomFlagLine(false);
2986                    }
2987                    this.getData(a17)?.setFlagLineLeftMargin(f17);
2988                    this.notifyDataChange(a17);
2989                    this.lastPassId = this.getData(a17)?.getNodeCurrentNodeId();
2990                }
2991            }
2992        }
2993    }
2994
2995    delayHighLightAndExpandNode(m16, n16, o16) {
2996        let p16 = m16 !== this.lastDelayExpandIndex ? true : false;
2997        let q16 = this.getData(o16)?.getIsOverBorder();
2998        let r16 = this.listNode[m16 + 1]?.getNodeCurrentNodeId();
2999        let s16 = this.findParentNodeId(n16);
3000        if (q16) {
3001            this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
3002        } else {
3003            this.lastDelayExpandIndex = m16;
3004        }
3005        if (q16 || p16) {
3006            let t16 = !q16 && (!this.isInnerDrag ||
3007                (this.expandAndCollapseInfo.get(n16) === NodeStatus.COLLAPSE && this.isInnerDrag) ||
3008                (!this.expandAndCollapseInfo.has(n16) && this.listNode[m16].getIsFolder()));
3009            if (t16) {
3010                this.changeNodeColor(m16, this.listNode[m16].getNodeStatus().hover);
3011                this.notifyDataChange(o16);
3012                let x16 = this.isInnerDrag ? 1000 : 0;
3013                this.timeoutHighLightId = setTimeout(() => {
3014                    this.delayHighLight(m16);
3015                    this.sendAccessibility(this.getStringByName('treeview_accessibility_move_node_child',
3016                        this.getPlaceAccessibleTitle(n16), 1));
3017                }, x16);
3018            }
3019            if (q16 || (this.lastTimeoutHighLightId !== this.INITIAL_INVALID_VALUE &&
3020                this.clearTimeoutHighLightId !== this.lastTimeoutHighLightId)) {
3021                clearTimeout(this.lastTimeoutHighLightId);
3022                if (this.lastDelayHighLightIndex !== this.INITIAL_INVALID_VALUE) {
3023                    this.clearHighLight(this.lastDelayHighLightIndex);
3024                    this.notifyDataReload();
3025                }
3026                this.clearTimeoutHighLightId = this.lastTimeoutHighLightId;
3027            }
3028            this.lastTimeoutHighLightId = this.timeoutHighLightId;
3029            this.lastDelayHighLightIndex = m16;
3030            if (!q16 && this.expandAndCollapseInfo.get(n16) === NodeStatus.COLLAPSE) {
3031                let u16 = this.getData(o16)?.getNodeInfoNode().children[0]?.currentNodeId;
3032                let v16 = 2000;
3033                this.timeoutExpandId = setTimeout(() => {
3034                    this.clearHighLight(this.lastDelayHighLightIndex);
3035                    if (u16 !== undefined) {
3036                        this.alterFlagLineAndExpandNode(m16, u16);
3037                    }
3038                }, v16);
3039            }
3040            if (q16 || (this.lastTimeoutExpandId !== this.INITIAL_INVALID_VALUE &&
3041                this.clearTimeoutExpandId !== this.lastTimeoutExpandId)) {
3042                clearTimeout(this.lastTimeoutExpandId);
3043                this.clearTimeoutExpandId = this.lastTimeoutExpandId;
3044            }
3045            this.lastTimeoutExpandId = this.timeoutExpandId;
3046        }
3047    }
3048
3049    delayHighLight(j16) {
3050        this.listNode.forEach((l16) => {
3051            if (l16.getNodeCurrentNodeId() === this.lastPassId) {
3052                l16.setCanShowFlagLine(false);
3053                l16.setCanShowBottomFlagLine(false);
3054                return;
3055            }
3056        });
3057        this.changeNodeColor(j16, this.listNode[j16].getNodeStatus().highLight);
3058        this.listNode[j16].setIsHighLight(true);
3059        this.changeNodeHighLightColor(j16, true);
3060        this.setImageSource(j16, InteractionStatus.DRAG_INSERT);
3061        this.setImageCollapseSource(j16, InteractionStatus.DRAG_INSERT);
3062        this.notifyDataReload();
3063    }
3064
3065    alterFlagLineAndExpandNode(d16, e16) {
3066        this.listNode.forEach((i16) => {
3067            if (i16.getNodeCurrentNodeId() === this.lastPassId) {
3068                i16.setCanShowFlagLine(false);
3069                i16.setCanShowBottomFlagLine(false);
3070            }
3071        });
3072        this.listNode.forEach((h16) => {
3073            if (this.isInnerDrag && h16.getNodeCurrentNodeId() === e16) {
3074                h16.setCanShowFlagLine(true);
3075            }
3076        });
3077        this.changeNodeStatus(d16);
3078        this.handleExpandAndCollapse(d16, true);
3079        this.lastPassId = e16;
3080    }
3081
3082    hideLastLine() {
3083        if (this.lastPassId !== this.INITIAL_INVALID_VALUE && this.loadedNodeIdAndIndexMap.has(this.lastPassId)) {
3084            this.listNode.forEach((c16) => {
3085                if (c16.getNodeCurrentNodeId() === this.lastPassId) {
3086                    c16.setCanShowFlagLine(false);
3087                    c16.setCanShowBottomFlagLine(false);
3088                    return;
3089                }
3090            });
3091            let a16 = this.loadedNodeIdAndIndexMap.get(this.lastPassId);
3092            this.notifyDataChange(a16);
3093        }
3094    }
3095
3096    clearLastTimeoutHighLight() {
3097        if (this.lastTimeoutHighLightId !== this.INITIAL_INVALID_VALUE &&
3098            this.clearTimeoutHighLightId !== this.lastTimeoutHighLightId) {
3099            clearTimeout(this.lastTimeoutHighLightId);
3100            if (this.lastDelayHighLightIndex !== this.INITIAL_INVALID_VALUE) {
3101                this.clearHighLight(this.lastDelayHighLightIndex);
3102            }
3103        }
3104    }
3105
3106    clearLastTimeoutExpand() {
3107        if (this.lastTimeoutExpandId !== this.INITIAL_INVALID_VALUE &&
3108            this.clearTimeoutExpandId !== this.lastTimeoutExpandId) {
3109            clearTimeout(this.lastTimeoutExpandId);
3110        }
3111    }
3112
3113    getSubtitle(z15) {
3114        if (this.nodeIdAndSubtitleMap.has(z15)) {
3115            if (typeof this.nodeIdAndSubtitleMap.get(z15) === 'number') {
3116                return this.nodeIdAndSubtitleMap.get(z15)?.toString();
3117            } else {
3118                return this.nodeIdAndSubtitleMap.get(z15);
3119            }
3120        } else {
3121            return '';
3122        }
3123    }
3124
3125    hasSubtitle(y15) {
3126        return this.nodeIdAndSubtitleMap.has(y15);
3127    }
3128
3129    initialParameterAboutDelayHighLightAndExpandIndex() {
3130        this.lastDelayHighLightIndex = this.INITIAL_INVALID_VALUE;
3131        this.lastDelayExpandIndex = this.INITIAL_INVALID_VALUE;
3132        this.lastPassIndex = this.INITIAL_INVALID_VALUE;
3133        this.draggingCurrentNodeId = this.INITIAL_INVALID_VALUE;
3134        this.flag = Flag.NONE;
3135    }
3136
3137    refreshSubtitle(x15) {
3138        this.nodeIdAndSubtitleMap.set(this.selectedParentNodeId, this.selectedParentNodeSubtitle);
3139        this.nodeIdAndSubtitleMap.set(x15, this.insertNodeSubtitle);
3140        this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(this.selectedParentNodeId));
3141        this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(x15));
3142    }
3143
3144    setNodeSubtitlePara(u15, v15, w15) {
3145        this.selectedParentNodeId = u15;
3146        this.selectedParentNodeSubtitle = v15;
3147        this.insertNodeSubtitle = w15;
3148    }
3149
3150    getInsertNodeSubtitle() {
3151        return this.insertNodeSubtitle;
3152    }
3153
3154    getExpandAndCollapseInfo(t15) {
3155        return this.expandAndCollapseInfo.get(t15);
3156    }
3157
3158    getLastDelayHighLightId() {
3159        return this.lastDelayHighLightId;
3160    }
3161
3162    setLastDelayHighLightId() {
3163        this.listNode.forEach((r15, s15) => {
3164            if (s15 === this.lastDelayHighLightIndex) {
3165                this.lastDelayHighLightId = r15.getNodeCurrentNodeId();
3166            }
3167        });
3168    }
3169
3170    setLastPassId(p15) {
3171        this.lastPassId = p15;
3172    }
3173
3174    setLastDelayHighLightIndex(o15) {
3175        this.lastDelayHighLightIndex = o15;
3176    }
3177
3178    alterDragNode(h14, i14, j14, k14, l14) {
3179        let m14 = [];
3180        let n14 = h14;
3181        let o14 = k14;
3182        let p14 = l14.getNodeInfoData();
3183        let q14 = null;
3184        let r14 = l14.getNodeInfoNode();
3185        let s14 = false;
3186        let t14 = this.INITIAL_INVALID_VALUE;
3187        let u14 = this.INITIAL_INVALID_VALUE;
3188        let v14 = this.flag === Flag.DOWN_FLAG ? true : false;
3189        u14 = this.getChildIndex(j14, k14);
3190        t14 = this.getChildIndex(h14, i14) + 1;
3191        if (h14 !== j14) {
3192            t14 = v14 ? t14 + 1 : t14;
3193        } else {
3194            if (t14 > u14) {
3195                t14 = v14 ? t14 : t14 - 1;
3196            } else {
3197                t14 = v14 ? t14 + 1 : t14;
3198            }
3199        }
3200        for (let n15 = 0; n15 < this.listNode.length; n15++) {
3201            if (this.listNode[n15].getNodeCurrentNodeId() === i14) {
3202                s14 = this.listNode[n15].getIsHighLight();
3203                if (this.flag === Flag.DOWN_FLAG && this.expandAndCollapseInfo.get(i14) === NodeStatus.EXPAND) {
3204                    n14 = i14;
3205                    t14 = 0;
3206                } else if (this.flag === Flag.UP_FLAG && this.expandAndCollapseInfo.get(i14) ===
3207                NodeStatus.EXPAND &&
3208                    this.listNode[n15].getCanShowFlagLine() === false) {
3209                    n14 = i14;
3210                    t14 = 0;
3211                } else if (s14) {
3212                    n14 = i14;
3213                    t14 = 0;
3214                }
3215                break;
3216            }
3217        }
3218        let w14 = {
3219            currentNodeId: o14,
3220            parentNodeId: n14,
3221            childIndex: t14,
3222        };
3223        this.appEventBus.emit(TreeListenType.NODE_MOVE, w14);
3224        m14.push({ parentId: n14, currentId: o14, data: p14 });
3225        let x14 = (j15, k15) => {
3226            if (j15) {
3227                n14 = j15.parentNodeId;
3228                o14 = j15.currentNodeId;
3229                for (let m15 = 0; m15 < k15.length; m15++) {
3230                    if (k15[m15].getNodeCurrentNodeId() === o14) {
3231                        q14 = k15[m15];
3232                        break;
3233                    }
3234                }
3235                if (q14 === null) {
3236                    return false;
3237                }
3238                let l15 = q14.getNodeInfoData();
3239                if (n14 !== j14) {
3240                    m14.push({ parentId: n14, currentId: o14, data: l15 });
3241                }
3242                return false;
3243            }
3244            return false;
3245        };
3246        this.dragTraverseNodeDF(x14, r14, this.listNode);
3247        let y14 = this.removeNode(k14, j14);
3248        if (y14.length === 0) {
3249            return;
3250        }
3251        let z14 = i14;
3252        let a15 = v14;
3253        if (this.expandAndCollapseInfo.get(i14) === NodeStatus.EXPAND) {
3254            a15 = false;
3255            this.listNode.forEach((i15) => {
3256                if (i15.getNodeCurrentNodeId() === i14 && i15.getCanShowFlagLine() === false) {
3257                    if (i15.getNodeInfoNode().children.length) {
3258                        z14 = i15.getNodeInfoNode().children[0].currentNodeId;
3259                    } else {
3260                        z14 = this.INITIAL_INVALID_VALUE;
3261                    }
3262                }
3263            });
3264        } else if (!this.expandAndCollapseInfo.get(i14) && s14) {
3265            this.expandAndCollapseInfo.set(i14, NodeStatus.EXPAND);
3266        }
3267        let b15 = this.addDragNode(m14[0].parentId, m14[0].currentId, z14, a15, m14[0].data);
3268        if (!b15) {
3269            return;
3270        }
3271        for (let f15 = 1; f15 < m14.length; f15++) {
3272            let g15 = this.addNode(m14[f15].parentId, m14[f15].currentId, m14[f15].data, false);
3273            if (!g15) {
3274                return;
3275            }
3276        }
3277        for (let e15 = 0; e15 < this.listNode.length; e15++) {
3278            if (this.listNode[e15].getNodeCurrentNodeId() === j14) {
3279                if (this.listNode[e15].getNodeItem().imageCollapse === null) {
3280                    this.listNode[e15].handleImageCollapseAfterAddNode(false);
3281                    this.expandAndCollapseInfo.delete(j14);
3282                    break;
3283                }
3284            }
3285        }
3286        let c15 = [...this.listNode];
3287        this.reloadListNode(c15);
3288    }
3289
3290    reloadListNode(z13) {
3291        let a14 = 0;
3292        let b14 = 0;
3293        this.listNode.splice(0, this.listNode.length);
3294        this.loadedNodeIdAndIndexMap.clear();
3295        this.loadedListNode.splice(0, this.loadedListNode.length);
3296        this.traverseNodeDF((d14) => {
3297            let e14 = d14.currentNodeId;
3298            if (e14 >= 0) {
3299                if (this.nodeIdNodeParamMap.has(e14)) {
3300                    let f14 = new NodeInfo(d14, this.nodeIdNodeParamMap.get(e14));
3301                    f14.addImageCollapse(d14.getChildNodeInfo().isHasChildNode);
3302                    this.listNode.push(f14);
3303                    this.nodeIdAndNodeIndexMap.set(f14.getNodeCurrentNodeId(), b14++);
3304                    if (this.expandAndCollapseInfo.get(e14) === NodeStatus.EXPAND) {
3305                        f14.getNodeItem()
3306                            .imageCollapse =
3307                            CollapseImageNodeFlyweightFactory.changeImageCollapseSource(NodeStatus.EXPAND,
3308                                f14.getNodeItem().imageCollapse?.isCollapse);
3309                    } else if (this.expandAndCollapseInfo.get(e14) === NodeStatus.COLLAPSE) {
3310                        f14.getNodeItem()
3311                            .imageCollapse =
3312                            CollapseImageNodeFlyweightFactory.changeImageCollapseSource(NodeStatus.COLLAPSE,
3313                                f14.getNodeItem().imageCollapse?.isCollapse);
3314                    }
3315                    for (let g14 = 0; g14 < z13.length; g14++) {
3316                        if (z13[g14].getNodeCurrentNodeId() === f14.getNodeCurrentNodeId()) {
3317                            f14.setNodeIsShow(z13[g14].getNodeIsShow());
3318                            f14.setListItemHeight(z13[g14].getListItemHeight());
3319                            if (f14.getNodeItem().mainTitleNode && f14.getIsShowTitle()) {
3320                                f14.getNodeItem().mainTitleNode.title = z13[g14].getNodeItem().mainTitleNode?.title;
3321                            }
3322                            break;
3323                        }
3324                    }
3325                    if (f14.getNodeIsShow()) {
3326                        this.loadedNodeIdAndIndexMap.set(f14.getNodeCurrentNodeId(), a14++);
3327                        this.loadedListNode.push(f14);
3328                    }
3329                }
3330            }
3331            return false;
3332        });
3333    }
3334
3335    getFlagLine() {
3336        return this.FLAG_LINE;
3337    }
3338
3339    getVisibility(w13) {
3340        let x13 = this.loadedNodeIdAndIndexMap.get(w13.getNodeCurrentNodeId()) - 1;
3341        if (x13 > this.INITIAL_INVALID_VALUE) {
3342            let y13 = this.getData(x13);
3343            return (w13.getCanShowFlagLine() === true && !w13.getIsHighLight() && !y13?.getIsHighLight()) ?
3344            Visibility.Visible : Visibility.Hidden;
3345        } else {
3346            return (w13.getCanShowFlagLine() === true && !w13.getIsHighLight()) ?
3347            Visibility.Visible : Visibility.Hidden;
3348        }
3349    }
3350
3351    getSubTitlePara() {
3352        return this.subTitle;
3353    }
3354
3355    getIsFolder(v13) {
3356        if (this.loadedNodeIdAndIndexMap.has(v13)) {
3357            return this.getData(this.loadedNodeIdAndIndexMap.get(v13))?.getIsFolder();
3358        }
3359        return false;
3360    }
3361
3362    getSubTitleFontColor(u13) {
3363        return u13 ? this.subTitle.highLightFontColor : this.treeViewTheme.secondaryTitleFontColor;
3364    }
3365
3366    getChildIndex(n13, o13) {
3367        let p13 = this.INITIAL_INVALID_VALUE;
3368        if (this.nodeIdNodeItemMap.has(n13)) {
3369            let q13 = this.nodeIdNodeItemMap.get(n13);
3370            if (q13.getCurrentNodeId() === n13) {
3371                q13.children.forEach((s13, t13) => {
3372                    if (s13.getCurrentNodeId() === o13) {
3373                        p13 = t13;
3374                        return;
3375                    }
3376                });
3377            }
3378        }
3379        return p13;
3380    }
3381
3382    setCurrentFocusNodeId(m13) {
3383        this.currentFocusNodeId = m13;
3384    }
3385
3386    getCurrentFocusNodeId() {
3387        return this.currentFocusNodeId;
3388    }
3389
3390    setLastFocusNodeId(l13) {
3391        this.lastFocusNodeId = l13;
3392    }
3393
3394    getLastFocusNodeId() {
3395        return this.lastFocusNodeId;
3396    }
3397
3398    getAddFocusNodeId() {
3399        return this.addFocusNodeId;
3400    }
3401
3402    setFlag(k13) {
3403        this.flag = k13;
3404    }
3405
3406    traverseNodeDF(f13, g13 = this._root) {
3407        let h13 = [];
3408        let i13 = false;
3409        h13.unshift(g13);
3410        let j13 = h13.shift();
3411        while (!i13 && j13) {
3412            i13 = f13(j13) === true;
3413            if (!i13) {
3414                h13.unshift(...j13.children);
3415                j13 = h13.shift();
3416            }
3417        }
3418    }
3419
3420    traverseSectionNodeDF(w12, x12 = this._root, y12, z12) {
3421        let a13 = [];
3422        let b13 = false;
3423        let c13 = false;
3424        a13.unshift(x12);
3425        let d13 = a13.shift();
3426        while (!b13 && d13) {
3427            try {
3428                if (y12 !== undefined && d13.nodeLevel < y12) {
3429                    c13 = true;
3430                }
3431                if (z12 !== undefined && d13.nodeLevel > z12) {
3432                    c13 = true;
3433                }
3434                if (!c13) {
3435                    b13 = w12(d13);
3436                }
3437            } catch (e13) {
3438                throw new Error('traverseSectionNodeDF function callbacks error');
3439            }
3440            if (!b13) {
3441                a13.unshift(...d13.children);
3442                d13 = a13.shift();
3443                c13 = false;
3444            }
3445        }
3446    }
3447
3448    updateParentChildNum(r12, s12, t12) {
3449        let u12 = r12.parentNodeId;
3450        while (u12 >= 0) {
3451            if (this.nodeIdNodeItemMap.has(u12)) {
3452                let v12 = this.nodeIdNodeItemMap.get(u12);
3453                v12.getChildNodeInfo().allChildNum =
3454                    s12 ? v12.getChildNodeInfo().allChildNum + t12 : v12.getChildNodeInfo().allChildNum - t12;
3455                u12 = v12.parentNodeId;
3456            } else {
3457                hilog.error(LOG_CODE, TAG, 'updateParentChildNum: parent node not found.');
3458                break;
3459            }
3460        }
3461    }
3462
3463    findParentNodeId(p12) {
3464        let q12 = new NodeItem(emptyNodeInfo);
3465        if (this.nodeIdNodeItemMap.has(p12)) {
3466            q12 = this.nodeIdNodeItemMap.get(p12);
3467        }
3468        return q12.parentNodeId;
3469    }
3470
3471    refreshRemoveNodeData(e12, f12) {
3472        let g12 = [];
3473        if (e12.length === 0) {
3474            return;
3475        }
3476        let h12 = undefined;
3477        for (let m12 = 0; m12 < e12.length; m12++) {
3478            if (this.loadedNodeIdAndIndexMap.has(e12[m12])) {
3479                let o12 = this.loadedNodeIdAndIndexMap.get(e12[m12]);
3480                g12.push(o12);
3481            }
3482            if (h12 === undefined && this.nodeIdAndNodeIndexMap.has(e12[m12])) {
3483                h12 = this.nodeIdAndNodeIndexMap.get(e12[m12]);
3484            }
3485            if (h12 !== undefined) {
3486                let n12 = this.listNode.splice(h12, 1);
3487                n12 = null;
3488            }
3489            if (this.expandAndCollapseInfo.has(e12[m12])) {
3490                this.expandAndCollapseInfo.delete(e12[m12]);
3491            }
3492        }
3493        g12.forEach((l12) => {
3494            this.notifyDataDelete(l12);
3495            this.notifyDataChange(l12);
3496        });
3497        if (f12.getNodeItem().imageCollapse === null) {
3498            if (this.nodeIdAndNodeIndexMap.has(f12.getNodeCurrentNodeId())) {
3499                let k12 = this.nodeIdAndNodeIndexMap.get(f12.getNodeCurrentNodeId());
3500                this.listNode[k12]?.handleImageCollapseAfterAddNode(false);
3501            }
3502            this.expandAndCollapseInfo.delete(f12.getNodeCurrentNodeId());
3503            this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(f12.getNodeCurrentNodeId()));
3504        }
3505        let i12 = {
3506            currentNodeId: f12.getNodeCurrentNodeId(),
3507            parentNodeId: f12.getNodeParentNodeId(),
3508        };
3509        this.loadedListNodeFunction();
3510        this.appEventBus.emit(TreeListenType.NODE_DELETE, i12);
3511    }
3512
3513    refreshAddNodeData(z11) {
3514        let a12 = new NodeInfo(new NodeItem(emptyNodeInfo), emptyNodeInfo);
3515        if (this.nodeIdNodeItemMap.has(z11[0])) {
3516            let d12 = this.nodeIdNodeItemMap.get(z11[0]);
3517            a12 = new NodeInfo(d12, this.nodeIdNodeParamMap.get(z11[0]));
3518            a12.addImageCollapse(d12.getChildNodeInfo().isHasChildNode);
3519        }
3520        a12.setIsModify(true);
3521        let b12 = 0;
3522        for (let c12 = 0; c12 < this.listNode.length; c12++) {
3523            if (this.listNode[c12].getNodeCurrentNodeId() === a12.getNodeParentNodeId()) {
3524                b12 = c12;
3525                if (this.listNode[c12].getNodeItem().imageCollapse === null) {
3526                    this.listNode[c12].handleImageCollapseAfterAddNode(true);
3527                    this.notifyDataChange(b12);
3528                } else if (this.expandAndCollapseInfo.get(this.listNode[c12].getNodeCurrentNodeId()) ===
3529                NodeStatus.COLLAPSE) {
3530                    this.changeNodeStatus(b12);
3531                }
3532                this.listNode.splice(c12 + 1, 0, a12);
3533                this.listNode[c12 + 1].setTitleAndInputTextStatus(true);
3534                this.listNode[c12 + 1].setNodeIsShow(true);
3535                this.listNode[c12 + 1].setListItemHeight(LIST_ITEM_HEIGHT);
3536                this.nodeIdAndNodeIndexMap.set(z11[0], c12 + 1);
3537                this.setImageSource(c12 + 1, InteractionStatus.EDIT);
3538                this.currentOperation = MenuOperation.ADD_NODE;
3539                this.notifyDataAdd(c12 + 1);
3540                this.notificationNodeInfo(c12 + 1, this.currentOperation);
3541                break;
3542            }
3543        }
3544        this.modifyNodeIndex = b12 + 1;
3545        this.setClickIndex(b12);
3546        this.lastIndex = b12;
3547        this.expandAndCollapseInfo.set(a12.getNodeParentNodeId(), NodeStatus.EXPAND);
3548        this.handleExpandAndCollapse(b12, true);
3549    }
3550
3551    refreshData(u11, v11, w11) {
3552        let x11 = new NodeInfo(new NodeItem(emptyNodeInfo), emptyNodeInfo);
3553        if (this.nodeIdNodeItemMap.has(v11)) {
3554            let y11 = this.nodeIdNodeItemMap.get(v11);
3555            x11 = new NodeInfo(y11, this.nodeIdNodeParamMap.get(v11));
3556            x11.addImageCollapse(y11.getChildNodeInfo().isHasChildNode);
3557        }
3558        if (u11 === MenuOperation.REMOVE_NODE) {
3559            this.nodeIdAndSubtitleMap.set(v11, this.selectedParentNodeSubtitle);
3560            this.notifyDataChange(this.loadedNodeIdAndIndexMap.get(v11));
3561            this.refreshRemoveNodeData(w11, x11);
3562        }
3563        if (u11 === MenuOperation.ADD_NODE) {
3564            this.addFocusNodeId = w11[0];
3565            this.nodeIdAndSubtitleMap.set(this.getClickNodeId(), this.selectedParentNodeSubtitle);
3566            this.nodeIdAndSubtitleMap.set(w11[0], this.insertNodeSubtitle);
3567            this.refreshAddNodeData(w11);
3568        }
3569    }
3570
3571    removeNode(k11, l11) {
3572        if (this.nodeIdNodeItemMap.has(l11) && this.nodeIdNodeItemMap.has(k11)) {
3573            let m11 = this.nodeIdNodeItemMap.get(l11);
3574            let n11 = this.nodeIdNodeItemMap.get(k11);
3575            let o11 = [];
3576            let p11 = n11.indexOfParent;
3577            let q11 = 0;
3578            if (p11 < 0) {
3579                hilog.error(LOG_CODE, TAG, 'node does not exist.');
3580                return [];
3581            } else {
3582                q11 = m11.children[p11].getChildNodeInfo().allChildNum + 1;
3583                this.freeNodeMemory(m11.children[p11], o11);
3584                for (let t11 = p11; t11 < m11.children.length; t11++) {
3585                    m11.children[t11].indexOfParent -= 1;
3586                }
3587                let s11 = m11.children.splice(p11, 1);
3588                s11 = null;
3589                this.judgeImageCollapse(l11);
3590            }
3591            m11.getChildNodeInfo().childNum = m11.children.length;
3592            m11.getChildNodeInfo().allChildNum -= (q11);
3593            let r11 = [];
3594            r11.push(m11.parentNodeId);
3595            delayUpdateParentChildNum(false, q11, this.nodeIdNodeItemMap, r11);
3596            return o11;
3597        } else {
3598            hilog.error(LOG_CODE, TAG, 'parent does not exist.');
3599            return [];
3600        }
3601    }
3602
3603    addNode(d11, e11, f11, g11) {
3604        if (this._root === null) {
3605            this._root = new NodeItem(emptyNodeInfo);
3606            this._root.nodeLevel = -1;
3607            this.nodeIdNodeItemMap.set(-1, this._root);
3608            this.nodeIdNodeParamMap.set(-1, emptyNodeInfo);
3609        }
3610        if (this.nodeIdNodeItemMap.has(d11)) {
3611            let h11 = this.nodeIdNodeItemMap.get(d11);
3612            let i11 = new NodeItem(f11);
3613            if (h11.nodeLevel > this.maxNodeLevel) {
3614                hilog.error(LOG_CODE, TAG, 'ListDataSource[addNode]: The level of the tree view cannot exceed 50.');
3615                return false;
3616            }
3617            i11.nodeLevel = h11.nodeLevel + 1;
3618            i11.parentNodeId = d11;
3619            i11.currentNodeId = e11;
3620            i11.indexOfParent = h11.children.length;
3621            f11.parentNodeId = d11;
3622            f11.currentNodeId = e11;
3623            if (f11.symbolIconStyle && !f11.icon) {
3624                f11.icon = 'symbolUsed';
3625            }
3626            h11.children.push(i11);
3627            h11.getChildNodeInfo().isHasChildNode = true;
3628            h11.getChildNodeInfo().childNum = h11.children.length;
3629            h11.getChildNodeInfo().allChildNum += 1;
3630            this.judgeImageCollapse(d11);
3631            if (g11) {
3632                this.updateNodeIdList.push(h11.parentNodeId);
3633            } else {
3634                let j11 = [];
3635                j11.push(h11.parentNodeId);
3636                delayUpdateParentChildNum(true, 1, this.nodeIdNodeItemMap, j11);
3637            }
3638            this.nodeIdNodeParamMap.set(e11, f11);
3639            this.nodeIdNodeItemMap.set(e11, i11);
3640            return true;
3641        } else {
3642            hilog.error(LOG_CODE, TAG, 'ListDataSource[addNode]: Parent node not found.');
3643            return false;
3644        }
3645    }
3646
3647    judgeImageCollapse(a11) {
3648        if (a11 === undefined) {
3649            return;
3650        }
3651        let b11 = this.nodeIdNodeItemMap.get(a11);
3652        let c11 = this.nodeIdAndNodeIndexMap.get(a11);
3653        if (b11.children.length > 0) {
3654            if (this.nodeIdAndNodeIndexMap.has(a11)) {
3655                this.listNode[c11]?.addImageExpand(true);
3656            }
3657        } else {
3658            this.listNode[c11]?.addImageExpand(false);
3659        }
3660    }
3661
3662    freeNodeMemory(s10, t10) {
3663        let u10 = [];
3664        let v10 = (z10) => {
3665            u10.push(z10);
3666            return false;
3667        };
3668        this.traverseNodeDF(v10, s10);
3669        u10.forEach((y10) => {
3670            t10.push(y10.getCurrentNodeId());
3671            this.nodeIdNodeItemMap.delete(y10.getCurrentNodeId());
3672            this.nodeIdNodeParamMap.delete(y10.getCurrentNodeId());
3673            y10 = new NodeItem(emptyNodeInfo);
3674        });
3675    }
3676
3677    getNodeInfoByNodeItem(q10) {
3678        if (q10?.currentNodeId === undefined) {
3679            hilog.error(LOG_CODE, TAG, 'getNodeInfoByNodeItem: currentId is undefined');
3680            return new NodeInfo(new NodeItem(emptyNodeInfo), emptyNodeInfo);
3681        }
3682        if (!this.nodeIdAndNodeIndexMap.has(q10.currentNodeId)) {
3683            hilog.error(LOG_CODE, TAG, 'getNodeInfoByNodeItem: not has nodeItem.');
3684            return new NodeInfo(new NodeItem(emptyNodeInfo), emptyNodeInfo);
3685        }
3686        let r10 = this.nodeIdAndNodeIndexMap.get(q10.currentNodeId);
3687        return this.listNode[r10];
3688    }
3689
3690    getNewNodeParam(l10) {
3691        let m10 = new NodeItem(emptyNodeInfo);
3692        if (this.nodeIdNodeItemMap.has(l10)) {
3693            m10 = this.nodeIdNodeItemMap.get(l10);
3694        }
3695        let n10 = emptyNodeInfo;
3696        if (m10) {
3697            let o10 = this.getNodeInfoByNodeItem(m10);
3698            if (m10.children.length === 0) {
3699                if (o10.getNodeItem().imageNode !== undefined) {
3700                    n10.icon = o10.getNodeItem().imageNode?.normalSource;
3701                    n10.symbolIconStyle = o10.getNodeItem().imageNode?.symbolNormalSource;
3702                    n10.selectedIcon = o10.getNodeItem().imageNode?.selectedSource;
3703                    n10.symbolSelectedIconStyle = o10.getNodeItem().imageNode?.symbolSelectedSource;
3704                    n10.editIcon = o10.getNodeItem().imageNode?.editSource;
3705                    n10.symbolEditIconStyle = o10.getNodeItem().imageNode?.symbolEditSource;
3706                    n10.container = o10.getMenu();
3707                } else {
3708                    n10.icon = undefined;
3709                    n10.symbolIconStyle = undefined;
3710                    n10.selectedIcon = undefined;
3711                    n10.symbolSelectedIconStyle = undefined;
3712                    n10.editIcon = undefined;
3713                    n10.symbolEditIconStyle = undefined;
3714                    n10.container = o10.getMenu();
3715                }
3716            } else if (m10.children.length > 0) {
3717                let p10 = this.getNodeInfoByNodeItem(m10.children[0]);
3718                if (o10.getNodeItem().imageNode !== null) {
3719                    n10.icon = (p10.getNodeItem().imageNode !== undefined) ?
3720                        p10.getNodeItem().imageNode?.normalSource : undefined;
3721                    n10.symbolIconStyle = (p10.getNodeItem().imageNode !== undefined) ?
3722                        p10.getNodeItem().imageNode?.symbolNormalSource : undefined;
3723                    n10.selectedIcon = (p10.getNodeItem().imageNode !== undefined) ?
3724                        p10.getNodeItem().imageNode?.selectedSource : undefined;
3725                    n10.symbolSelectedIconStyle = (p10.getNodeItem().imageNode !== undefined) ?
3726                        p10.getNodeItem().imageNode?.symbolSelectedSource : undefined;
3727                    n10.editIcon = (p10.getNodeItem().imageNode !== undefined) ?
3728                        p10.getNodeItem().imageNode?.editSource : undefined;
3729                    n10.symbolEditIconStyle = (p10.getNodeItem().imageNode !== undefined) ?
3730                        p10.getNodeItem().imageNode?.symbolEditSource : undefined;
3731                    n10.container = p10.getMenu();
3732                } else {
3733                    n10.icon = undefined;
3734                    n10.symbolIconStyle = undefined;
3735                    n10.selectedIcon = undefined;
3736                    n10.symbolSelectedIconStyle = undefined;
3737                    n10.editIcon = undefined;
3738                    n10.symbolEditIconStyle = undefined;
3739                    n10.container = p10.getMenu();
3740                }
3741            }
3742        }
3743        return n10;
3744    }
3745
3746    getClickChildId(g10) {
3747        let h10 = new NodeItem(emptyNodeInfo);
3748        if (this.nodeIdNodeItemMap.has(g10)) {
3749            h10 = this.nodeIdNodeItemMap.get(g10);
3750        }
3751        if (h10) {
3752            if (h10.children.length === 0) {
3753                return [];
3754            } else if (h10.children.length > 0) {
3755                let i10 = new Array(h10.children.length);
3756                for (let k10 = 0; k10 < i10.length; k10++) {
3757                    i10[k10] = 0;
3758                }
3759                for (let j10 = 0; j10 < h10.children.length && j10 < i10.length; j10++) {
3760                    i10[j10] = h10.children[j10].currentNodeId;
3761                }
3762                return i10;
3763            }
3764        }
3765        return [];
3766    }
3767
3768    getClickNodeChildrenInfo(a10) {
3769        let b10 = new NodeItem(emptyNodeInfo);
3770        if (this.nodeIdNodeItemMap.has(a10)) {
3771            b10 = this.nodeIdNodeItemMap.get(a10);
3772        }
3773        if (b10) {
3774            if (b10.children.length === 0) {
3775                return [];
3776            } else if (b10.children.length > 0) {
3777                let c10 = new Array(b10.children.length);
3778                for (let f10 = 0; f10 < c10.length; f10++) {
3779                    c10[f10] = {};
3780                }
3781                for (let d10 = 0; d10 < b10.children.length && d10 < c10.length; d10++) {
3782                    c10[d10].itemId = b10.children[d10].currentNodeId;
3783                    let e10 = this.getNodeInfoByNodeItem(b10.children[d10]);
3784                    if (e10.getNodeItem().imageNode) {
3785                        c10[d10].itemIcon = e10.getNodeItem().imageNode?.source;
3786                    }
3787                    if (e10.getNodeItem().mainTitleNode) {
3788                        c10[d10].itemTitle = e10.getNodeItem().mainTitleNode?.title;
3789                    }
3790                    c10[d10].isFolder = e10.getIsFolder();
3791                }
3792                return c10;
3793            }
3794        }
3795        return [];
3796    }
3797
3798    checkMainTitleIsValid(z9) {
3799        if (new RegExp('/[\\\/:*?" < > |]/').test(z9)){
3800            return false;
3801        }
3802        if ((new RegExp('/^[\u4e00-\u9fa5]+$/').test(z9) && z9.length > this.MAX_CN_LENGTH) ||
3803            (!new RegExp('/^[\u4e00-\u9fa5]+$/').test(z9) && z9.length > this.MAX_EN_LENGTH)) {
3804            return false;
3805        }
3806        return true;
3807    }
3808
3809    dragTraverseNodeDF(t9, u9 = this._root, v9) {
3810        let w9 = [];
3811        let x9 = false;
3812        w9.unshift(u9);
3813        let y9 = w9.shift();
3814        while (!x9 && y9) {
3815            x9 = t9(y9, v9) === true;
3816            if (!x9) {
3817                w9.unshift(...y9.children);
3818                y9 = w9.shift();
3819            }
3820        }
3821    }
3822
3823    updateChildIndexOfParent(q9, r9) {
3824        for (let s9 = q9; s9 < r9.children.length; s9++) {
3825            r9.children[s9].indexOfParent += 1;
3826        }
3827    }
3828
3829    addDragNode(h9, i9, j9, k9, l9) {
3830        if (this._root === null) {
3831            this._root = new NodeItem(emptyNodeInfo);
3832            this._root.nodeLevel = this.INITIAL_INVALID_VALUE;
3833        }
3834        if (this.nodeIdNodeItemMap.has(h9)) {
3835            let m9 = this.nodeIdNodeItemMap.get(h9);
3836            let n9 = new NodeItem(l9);
3837            if (m9.nodeLevel > this.maxNodeLevel) {
3838                hilog.error(LOG_CODE, TAG, 'addDragNode: The level of the tree view cannot exceed 50.');
3839                return false;
3840            }
3841            n9.nodeLevel = m9.nodeLevel + 1;
3842            n9.parentNodeId = h9;
3843            n9.currentNodeId = i9;
3844            l9.parentNodeId = h9;
3845            l9.currentNodeId = i9;
3846            let o9 = this.INITIAL_INVALID_VALUE;
3847            if (m9.children.length) {
3848                for (let p9 = 0; p9 < m9.children.length; p9++) {
3849                    if (m9.children[p9].getCurrentNodeId() === j9) {
3850                        o9 = p9;
3851                        break;
3852                    }
3853                }
3854                if (k9) {
3855                    n9.indexOfParent = o9 + 1;
3856                    this.updateChildIndexOfParent(n9.indexOfParent, m9);
3857                    m9.children.splice(o9 + 1, 0, n9);
3858                } else {
3859                    n9.indexOfParent = o9 < 0 ? m9.children.length + o9 : o9;
3860                    this.updateChildIndexOfParent(n9.indexOfParent, m9);
3861                    m9.children.splice(o9, 0, n9);
3862                }
3863            } else {
3864                n9.indexOfParent = m9.children.length;
3865                m9.children.push(n9);
3866            }
3867            m9.getChildNodeInfo().isHasChildNode = true;
3868            m9.getChildNodeInfo().childNum = m9.children.length;
3869            m9.getChildNodeInfo().allChildNum += 1;
3870            this.updateParentChildNum(m9, true, 1);
3871            this.nodeIdNodeItemMap.set(i9, n9);
3872            this.nodeIdNodeParamMap.set(i9, l9);
3873            return true;
3874        } else {
3875            hilog.error(LOG_CODE, TAG, 'addDragNode: Parent node not found.');
3876            return false;
3877        }
3878    }
3879}
3880
3881class ButtonGestureModifier {
3882    constructor(g9) {
3883        this.fontSize = 1;
3884        this.controller = null;
3885        this.controller = g9;
3886    }
3887
3888    applyGesture(d9) {
3889        if (this.fontSize >= ButtonGestureModifier.minFontSize) {
3890            d9.addGesture(new LongPressGestureHandler({ repeat: false, duration: ButtonGestureModifier.longPressTime })
3891                .onAction(() => {
3892                    if (d9) {
3893                        this.controller?.open();
3894                    }
3895                })
3896                .onActionEnd(() => {
3897                    this.controller?.close();
3898                }));
3899        } else {
3900            d9.clearGestures();
3901        }
3902    }
3903}
3904
3905ButtonGestureModifier.longPressTime = 500;
3906ButtonGestureModifier.minFontSize = 1.75;
3907
3908export class TreeViewInner extends ViewPU {
3909    constructor(w8, x8, y8, z8 = -1, a9 = undefined, b9) {
3910        super(w8, y8, z8, b9);
3911        if (typeof a9 === 'function') {
3912            this.paramsGenerator_ = a9;
3913        }
3914        this.__item = new SynchedPropertyNesedObjectPU(x8.item, this, 'item');
3915        this.listNodeDataSource = new ListNodeDataSource();
3916        this.__columnWidth = new ObservedPropertySimplePU(0, this, 'columnWidth');
3917        this.__isFocused = new ObservedPropertySimplePU(false, this, 'isFocused');
3918        this.__index = new ObservedPropertySimplePU(-1, this, 'index');
3919        this.__lastIndex = new ObservedPropertySimplePU(-1, this, 'lastIndex');
3920        this.__count = new ObservedPropertySimplePU(0, this, 'count');
3921        this.__followingSystemFontScale = new ObservedPropertySimplePU(false, this, 'followingSystemFontScale');
3922        this.__maxAppFontScale = new ObservedPropertySimplePU(1, this, 'maxAppFontScale');
3923        this.__treeViewTheme = this.initializeConsume('treeViewTheme', 'treeViewTheme');
3924        this.__clickButtonFlag = this.initializeConsume('clickButtonFlag', 'clickButtonFlag');
3925        this.__accessibilityNodeType = this.initializeConsume('accessibilityNodeType', 'accessibilityNodeType');
3926        this.__isAccessibilityEnabled = this.initializeConsume('isAccessibilityEnabled', 'isAccessibilityEnabled');
3927        this.listTreeViewMenu = undefined;
3928        this.callBackClick = () => {
3929        };
3930        this.MAX_CN_LENGTH = 254;
3931        this.MAX_EN_LENGTH = 255;
3932        this.INITIAL_INVALID_VALUE = -1;
3933        this.MAX_TOUCH_DOWN_COUNT = 0;
3934        this.isMultiPress = false;
3935        this.touchDownCount = this.INITIAL_INVALID_VALUE;
3936        this.appEventBus = TreeListenerManager.getInstance().getTreeListener();
3937        this.itemPadding = {
3938            left: {
3939                'id': -1,
3940                'type': 10002,
3941                params: ['sys.float.ohos_id_card_margin_start'],
3942                'bundleName': '__harDefaultBundleName__',
3943                'moduleName': '__harDefaultModuleName__',
3944            },
3945            right: {
3946                'id': -1,
3947                'type': 10002,
3948                params: ['sys.float.ohos_id_card_margin_end'],
3949                'bundleName': '__harDefaultBundleName__',
3950                'moduleName': '__harDefaultModuleName__',
3951            },
3952            top: {
3953                'id': -1,
3954                'type': 10002,
3955                params: ['sys.float.ohos_id_text_margin_vertical'],
3956                'bundleName': '__harDefaultBundleName__',
3957                'moduleName': '__harDefaultModuleName__',
3958            },
3959            bottom: {
3960                'id': -1,
3961                'type': 10002,
3962                params: ['sys.float.padding_level0'],
3963                'bundleName': '__harDefaultBundleName__',
3964                'moduleName': '__harDefaultModuleName__',
3965            },
3966        };
3967        this.textInputPadding = {
3968            left: {
3969                'id': -1,
3970                'type': 10002,
3971                params: ['sys.float.padding_level0'],
3972                'bundleName': '__harDefaultBundleName__',
3973                'moduleName': '__harDefaultModuleName__',
3974            },
3975            right: {
3976                'id': -1,
3977                'type': 10002,
3978                params: ['sys.float.padding_level0'],
3979                'bundleName': '__harDefaultBundleName__',
3980                'moduleName': '__harDefaultModuleName__',
3981            },
3982            top: {
3983                'id': -1,
3984                'type': 10002,
3985                params: ['sys.float.padding_level0'],
3986                'bundleName': '__harDefaultBundleName__',
3987                'moduleName': '__harDefaultModuleName__',
3988            },
3989            bottom: {
3990                'id': -1,
3991                'type': 10002,
3992                params: ['sys.float.padding_level0'],
3993                'bundleName': '__harDefaultBundleName__',
3994                'moduleName': '__harDefaultModuleName__',
3995            },
3996        };
3997        this.inputFontSize = resourceManager.getSystemResourceManager().getNumberByName('ohos_id_text_size_body1');
3998        this.setInitiallyProvidedValue(x8);
3999        this.finalizeConstruction();
4000    }
4001
4002    setInitiallyProvidedValue(v8) {
4003        this.__item.set(v8.item);
4004        if (v8.listNodeDataSource !== undefined) {
4005            this.listNodeDataSource = v8.listNodeDataSource;
4006        }
4007        if (v8.columnWidth !== undefined) {
4008            this.columnWidth = v8.columnWidth;
4009        }
4010        if (v8.isFocused !== undefined) {
4011            this.isFocused = v8.isFocused;
4012        }
4013        if (v8.index !== undefined) {
4014            this.index = v8.index;
4015        }
4016        if (v8.lastIndex !== undefined) {
4017            this.lastIndex = v8.lastIndex;
4018        }
4019        if (v8.count !== undefined) {
4020            this.count = v8.count;
4021        }
4022        if (v8.followingSystemFontScale !== undefined) {
4023            this.followingSystemFontScale = v8.followingSystemFontScale;
4024        }
4025        if (v8.maxAppFontScale !== undefined) {
4026            this.maxAppFontScale = v8.maxAppFontScale;
4027        }
4028        if (v8.listTreeViewMenu !== undefined) {
4029            this.listTreeViewMenu = v8.listTreeViewMenu;
4030        }
4031        if (v8.callBackClick !== undefined) {
4032            this.callBackClick = v8.callBackClick;
4033        }
4034        if (v8.MAX_CN_LENGTH !== undefined) {
4035            this.MAX_CN_LENGTH = v8.MAX_CN_LENGTH;
4036        }
4037        if (v8.MAX_EN_LENGTH !== undefined) {
4038            this.MAX_EN_LENGTH = v8.MAX_EN_LENGTH;
4039        }
4040        if (v8.INITIAL_INVALID_VALUE !== undefined) {
4041            this.INITIAL_INVALID_VALUE = v8.INITIAL_INVALID_VALUE;
4042        }
4043        if (v8.MAX_TOUCH_DOWN_COUNT !== undefined) {
4044            this.MAX_TOUCH_DOWN_COUNT = v8.MAX_TOUCH_DOWN_COUNT;
4045        }
4046        if (v8.isMultiPress !== undefined) {
4047            this.isMultiPress = v8.isMultiPress;
4048        }
4049        if (v8.touchDownCount !== undefined) {
4050            this.touchDownCount = v8.touchDownCount;
4051        }
4052        if (v8.appEventBus !== undefined) {
4053            this.appEventBus = v8.appEventBus;
4054        }
4055        if (v8.itemPadding !== undefined) {
4056            this.itemPadding = v8.itemPadding;
4057        }
4058        if (v8.textInputPadding !== undefined) {
4059            this.textInputPadding = v8.textInputPadding;
4060        }
4061        if (v8.inputFontSize !== undefined) {
4062            this.inputFontSize = v8.inputFontSize;
4063        }
4064    }
4065
4066    updateStateVars(u8) {
4067        this.__item.set(u8.item);
4068    }
4069
4070    purgeVariableDependenciesOnElmtId(t8) {
4071        this.__item.purgeDependencyOnElmtId(t8);
4072        this.__columnWidth.purgeDependencyOnElmtId(t8);
4073        this.__isFocused.purgeDependencyOnElmtId(t8);
4074        this.__index.purgeDependencyOnElmtId(t8);
4075        this.__lastIndex.purgeDependencyOnElmtId(t8);
4076        this.__count.purgeDependencyOnElmtId(t8);
4077        this.__followingSystemFontScale.purgeDependencyOnElmtId(t8);
4078        this.__maxAppFontScale.purgeDependencyOnElmtId(t8);
4079        this.__treeViewTheme.purgeDependencyOnElmtId(t8);
4080        this.__clickButtonFlag.purgeDependencyOnElmtId(t8);
4081        this.__accessibilityNodeType.purgeDependencyOnElmtId(t8);
4082        this.__isAccessibilityEnabled.purgeDependencyOnElmtId(t8);
4083    }
4084
4085    aboutToBeDeleted() {
4086        this.__item.aboutToBeDeleted();
4087        this.__columnWidth.aboutToBeDeleted();
4088        this.__isFocused.aboutToBeDeleted();
4089        this.__index.aboutToBeDeleted();
4090        this.__lastIndex.aboutToBeDeleted();
4091        this.__count.aboutToBeDeleted();
4092        this.__followingSystemFontScale.aboutToBeDeleted();
4093        this.__maxAppFontScale.aboutToBeDeleted();
4094        this.__treeViewTheme.aboutToBeDeleted();
4095        this.__clickButtonFlag.aboutToBeDeleted();
4096        this.__accessibilityNodeType.aboutToBeDeleted();
4097        this.__isAccessibilityEnabled.aboutToBeDeleted();
4098        SubscriberManager.Get().delete(this.id__());
4099        this.aboutToBeDeletedInternal();
4100    }
4101
4102    get item() {
4103        return this.__item.get();
4104    }
4105
4106    get columnWidth() {
4107        return this.__columnWidth.get();
4108    }
4109
4110    set columnWidth(s8) {
4111        this.__columnWidth.set(s8);
4112    }
4113
4114    get isFocused() {
4115        return this.__isFocused.get();
4116    }
4117
4118    set isFocused(r8) {
4119        this.__isFocused.set(r8);
4120    }
4121
4122    get index() {
4123        return this.__index.get();
4124    }
4125
4126    set index(q8) {
4127        this.__index.set(q8);
4128    }
4129
4130    get lastIndex() {
4131        return this.__lastIndex.get();
4132    }
4133
4134    set lastIndex(p8) {
4135        this.__lastIndex.set(p8);
4136    }
4137
4138    get count() {
4139        return this.__count.get();
4140    }
4141
4142    set count(o8) {
4143        this.__count.set(o8);
4144    }
4145
4146    get followingSystemFontScale() {
4147        return this.__followingSystemFontScale.get();
4148    }
4149
4150    set followingSystemFontScale(n8) {
4151        this.__followingSystemFontScale.set(n8);
4152    }
4153
4154    get maxAppFontScale() {
4155        return this.__maxAppFontScale.get();
4156    }
4157
4158    set maxAppFontScale(m8) {
4159        this.__maxAppFontScale.set(m8);
4160    }
4161
4162    get treeViewTheme() {
4163        return this.__treeViewTheme.get();
4164    }
4165
4166    set treeViewTheme(l8) {
4167        this.__treeViewTheme.set(l8);
4168    }
4169
4170    get clickButtonFlag() {
4171        return this.__clickButtonFlag.get();
4172    }
4173
4174    set clickButtonFlag(k8) {
4175        this.__clickButtonFlag.set(k8);
4176    }
4177
4178    get accessibilityNodeType() {
4179        return this.__accessibilityNodeType.get();
4180    }
4181
4182    set accessibilityNodeType(j8) {
4183        this.__accessibilityNodeType.set(j8);
4184    }
4185
4186    get isAccessibilityEnabled() {
4187        return this.__isAccessibilityEnabled.get();
4188    }
4189
4190    set isAccessibilityEnabled(i8) {
4191        this.__isAccessibilityEnabled.set(i8);
4192    }
4193
4194    aboutToAppear() {
4195        if (this.item.getNodeItem().imageNode) {
4196            this.item.imageSource = this.item.getNodeItem().imageNode?.source;
4197            this.item.symbolSource = this.item.getNodeItem().imageNode?.symbolSource;
4198        }
4199        let h8 = this.getUIContext();
4200        this.followingSystemFontScale = h8.isFollowingSystemFontScale();
4201        this.maxAppFontScale = h8.getMaxFontScale();
4202    }
4203
4204    decideFontScale() {
4205        let f8 = this.getUIContext();
4206        let g8 = f8.getHostContext()?.config?.fontSizeScale ?? 1;
4207        if (!this.followingSystemFontScale) {
4208            return 1;
4209        }
4210        return Math.min(g8, this.maxAppFontScale, MAX_FONT_SCALE);
4211    }
4212
4213    decideSymbolFontScale(b8) {
4214        if (!b8 || !this.followingSystemFontScale) {
4215            return 1;
4216        }
4217        let c8 = this.getUIContext();
4218        let d8 = c8.getHostContext()?.config?.fontSizeScale ?? 1;
4219        let e8 = Math.min(d8, this.maxAppFontScale, MAX_SYMBOL_FONT_SCALE);
4220        return Math.max(e8, MIN_SYMBOL_FONT_SCALE);
4221    }
4222
4223    getInputTextMaxFontSize() {
4224        let a8 = this.decideFontScale() * this.inputFontSize + 'vp';
4225        return a8;
4226    }
4227
4228    getLeftIconColor() {
4229        if (this.item.getIsModify() || this.item.getIsHighLight()) {
4230            return {
4231                'id': -1,
4232                'type': 10001,
4233                params: ['sys.color.icon_on_primary'],
4234                'bundleName': '__harDefaultBundleName__',
4235                'moduleName': '__harDefaultModuleName__',
4236            };
4237        } else if (this.item.getIsSelected()) {
4238            return this.treeViewTheme.leftIconActiveColor;
4239        } else {
4240            return this.treeViewTheme.leftIconColor;
4241        }
4242    }
4243
4244    getPrimaryTextColor() {
4245        if (this.item.getIsModify() || this.item.getIsHighLight()) {
4246            return {
4247                'id': -1,
4248                'type': 10001,
4249                params: ['sys.color.ohos_id_color_primary_contrary'],
4250                'bundleName': '__harDefaultBundleName__',
4251                'moduleName': '__harDefaultModuleName__',
4252            };
4253        } else if (this.item.getIsSelected()) {
4254            return this.treeViewTheme.primaryTitleActiveFontColor;
4255        } else {
4256            return this.treeViewTheme.primaryTitleFontColor;
4257        }
4258    }
4259
4260    checkInvalidPattern(z7) {
4261        return new RegExp('/[\\\/:*?" < > |]/').test(z7);
4262    }
4263
4264    checkIsAllCN(y7) {
4265        return new RegExp('/^[\u4e00-\u9fa5]+$/').test(y7);
4266    }
4267
4268    getAccessibilityReadText(g7) {
4269        let h7 = this.listNodeDataSource.nodeIdNodeItemMap.get(g7);
4270        if (h7 === undefined || g7 === undefined) {
4271            return '';
4272        }
4273        let i7 = this.listNodeDataSource.getNodeInfoByNodeItem(h7);
4274        let j7 = i7?.getNodeInfoData()?.primaryTitle === undefined
4275            ? '' : i7?.getNodeInfoData()?.primaryTitle;
4276        let k7 = i7?.getNodeInfoData()?.secondaryTitle === undefined
4277            ? '' : i7?.getNodeInfoData()?.secondaryTitle;
4278        let l7 = this.listNodeDataSource.getAccessibleTitleText(j7);
4279        let m7 = this.listNodeDataSource.getAccessibleTitleText(k7);
4280        let n7 = `${l7}, ${m7}`;
4281        let o7 = this.listNodeDataSource.findParentNodeId(g7);
4282        let p7 = [];
4283        let q7 = 0;
4284        let r7 = this.listNodeDataSource.getClickNodeChildrenInfo(o7);
4285        let s7 = r7.map(x7 => x7.itemId);
4286        let t7 = s7.indexOf(g7) + 1;
4287        let u7 = this.listNodeDataSource.getAccessibleTitle(g7);
4288        if (u7 === undefined) {
4289            return ' ';
4290        }
4291        if (this.accessibilityNodeType === AccessibilityNodeType.PLACE) {
4292            if (this.listNodeDataSource.findParentNodeId(g7) === -1) {
4293                for (let w7 = 0; w7 < this.listNodeDataSource.listNode.length; w7++) {
4294                    if (this.listNodeDataSource.listNode[w7].getNodeParentNodeId() === -1) {
4295                        p7.push(this.listNodeDataSource.listNode[w7].getNodeCurrentNodeId());
4296                    }
4297                }
4298                q7 = p7.indexOf(g7) + 1;
4299                return this.listNodeDataSource.getStringByName('treeview_accessibility_place_node_parent', q7);
4300            } else {
4301                return this.listNodeDataSource.getStringByName('treeview_accessibility_place_node_child', u7, t7);
4302            }
4303        } else if (this.accessibilityNodeType === AccessibilityNodeType.LIFT) {
4304            return n7;
4305        } else {
4306            return n7;
4307        }
4308    }
4309
4310    getAccessibilityDescription() {
4311        if (this.accessibilityNodeType === AccessibilityNodeType.TEXT) {
4312            return this.listNodeDataSource.getStringByName('treeview_accessibility_node_desc');
4313        } else {
4314            return ' ';
4315        }
4316    }
4317
4318    getAccessibilityReadButtonText(f7) {
4319        if (this.clickButtonFlag === false) {
4320            return this.item.getNodeItem().imageCollapse?.collapseSource === ARROW_RIGHT
4321                ? this.listNodeDataSource.getStringByName('treeview_accessibility_folded_node')
4322                : this.listNodeDataSource.getStringByName('treeview_accessibility_expanded_node');
4323        } else {
4324            return f7 ? this.listNodeDataSource.getStringByName('treeview_accessibility_expand_node')
4325                : this.listNodeDataSource.getStringByName('treeview_accessibility_fold_node');
4326        }
4327    }
4328
4329    getAccessibilityReadButtonDescription() {
4330        if (this.clickButtonFlag === false) {
4331            return ' ';
4332        } else {
4333            return this.listNodeDataSource.getStringByName('treeview_accessibility_implement_node');
4334        }
4335    }
4336
4337    onTouchNode(c7) {
4338        this.count++;
4339        if (this.count > 1) {
4340            this.count--;
4341            return;
4342        }
4343        this.index = this.listNodeDataSource.findIndex(this.item.getNodeCurrentNodeId());
4344        this.listNodeDataSource.setClickIndex(this.index);
4345        let d7 = this.item.getNodeCurrentNodeId();
4346        if (c7.type === TouchType.Down) {
4347            this.item.setNodeColor(this.treeViewTheme.itemPressedBgColor);
4348        } else if (c7.type === TouchType.Up) {
4349            if (!(typeof this.treeViewTheme.itemSelectedBgColor === 'string')) {
4350                this.item.setNodeColor(COLOR_SELECT);
4351            } else {
4352                this.item.setNodeColor(this.treeViewTheme.itemSelectedBgColor);
4353            }
4354            if (this.item.getNodeItem().imageNode !== null) {
4355                this.item.getNodeItem().imageNode?.setImageSource(InteractionStatus.SELECTED);
4356                this.listNodeDataSource.setImageSource(this.index, InteractionStatus.SELECTED);
4357                this.item.imageSource = this.item.getNodeItem().imageNode?.source;
4358                this.item.symbolSource = this.item.getNodeItem().imageNode?.symbolSource;
4359            }
4360            this.item.getNodeItem().mainTitleNode?.setMainTitleSelected(true);
4361            let e7 = { currentNodeId: d7 };
4362            this.appEventBus.emit(TreeListenType.NODE_CLICK, e7);
4363            this.listNodeDataSource.sendAccessibility(this.item.getIsSelected()
4364                ? this.listNodeDataSource.getStringByName('treeview_accessibility_select_node',
4365                `${this.getAccessibilityReadText(this.item.getNodeCurrentNodeId())}`) : '');
4366        }
4367        if (this.listNodeDataSource.getLastIndex() !== -1 && this.index !== this.listNodeDataSource.getLastIndex()) {
4368            this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false,
4369                this.listNodeDataSource.getLastIndex());
4370            this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(),
4371                MenuOperation.COMMIT_NODE);
4372        }
4373        this.lastIndex = this.index;
4374        this.count--;
4375    }
4376
4377    onClickNode() {
4378        this.count++;
4379        if (this.count > 1) {
4380            this.count--;
4381            return;
4382        }
4383        this.index = this.listNodeDataSource.findIndex(this.item.getNodeCurrentNodeId());
4384        this.listNodeDataSource.setClickIndex(this.index);
4385        let a7 = this.item.getNodeCurrentNodeId();
4386        if (!(typeof this.treeViewTheme.itemSelectedBgColor === 'string')) {
4387            this.item.setNodeColor(COLOR_SELECT);
4388        } else {
4389            this.item.setNodeColor(this.treeViewTheme.itemSelectedBgColor);
4390        }
4391        if (this.item.getNodeItem().imageNode !== null) {
4392            this.item.getNodeItem().imageNode?.setImageSource(InteractionStatus.SELECTED);
4393            this.listNodeDataSource.setImageSource(this.index, InteractionStatus.SELECTED);
4394            this.item.imageSource = this.item.getNodeItem().imageNode?.source;
4395            this.item.symbolSource = this.item.getNodeItem().imageNode?.symbolSource;
4396        }
4397        this.item.getNodeItem().mainTitleNode?.setMainTitleSelected(true);
4398        let b7 = { currentNodeId: a7 };
4399        this.appEventBus.emit(TreeListenType.NODE_CLICK, b7);
4400        this.listNodeDataSource.sendAccessibility(this.item.getIsSelected()
4401            ? this.listNodeDataSource.getStringByName('treeview_accessibility_select_node',
4402            `${this.getAccessibilityReadText(this.item.getNodeCurrentNodeId())}`) : '');
4403        if (this.listNodeDataSource.getLastIndex() !== -1 && this.index !== this.listNodeDataSource.getLastIndex()) {
4404            this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false,
4405                this.listNodeDataSource.getLastIndex());
4406            this.listNodeDataSource.setItemVisibilityOnEdit(this.listNodeDataSource.getLastIndex(),
4407                MenuOperation.COMMIT_NODE);
4408        }
4409        this.lastIndex = this.index;
4410        this.count--;
4411    }
4412
4413    accessibilityRefocus() {
4414        this.clickButtonFlag = false;
4415        let x6 = ({
4416            type: 'requestFocusForAccessibility',
4417            bundleName: getContext()?.abilityInfo?.bundleName,
4418            triggerAction: 'common',
4419            customId: `treeView_button${this.item.getNodeCurrentNodeId()}`
4420        });
4421        accessibility.sendAccessibilityEvent(x6).then(() => {
4422            setTimeout(() => {
4423                this.clickButtonFlag = true;
4424            }, ENTER_EXIT_DURATION);
4425        });
4426    }
4427
4428    popupForShowTitle(n6, o6, p6, q6 = null) {
4429        this.observeComponentCreation2((v6, w6) => {
4430            Row.create();
4431            Row.backgroundColor(o6);
4432            Row.border({
4433                radius: {
4434                    'id': -1,
4435                    'type': 10002,
4436                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
4437                    'bundleName': '__harDefaultBundleName__',
4438                    'moduleName': '__harDefaultModuleName__',
4439                }
4440            });
4441            Row.padding({
4442                left: {
4443                    'id': -1,
4444                    'type': 10002,
4445                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
4446                    'bundleName': '__harDefaultBundleName__',
4447                    'moduleName': '__harDefaultModuleName__',
4448                },
4449                right: {
4450                    'id': -1,
4451                    'type': 10002,
4452                    params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
4453                    'bundleName': '__harDefaultBundleName__',
4454                    'moduleName': '__harDefaultModuleName__',
4455                },
4456                top: {
4457                    'id': -1,
4458                    'type': 10002,
4459                    params: ['sys.float.ohos_id_card_margin_middle'],
4460                    'bundleName': '__harDefaultBundleName__',
4461                    'moduleName': '__harDefaultModuleName__',
4462                },
4463                bottom: {
4464                    'id': -1,
4465                    'type': 10002,
4466                    params: ['sys.float.ohos_id_card_margin_middle'],
4467                    'bundleName': '__harDefaultBundleName__',
4468                    'moduleName': '__harDefaultModuleName__',
4469                },
4470            });
4471        }, Row);
4472        this.observeComponentCreation2((t6, u6) => {
4473            Text.create(n6);
4474            Text.fontSize({
4475                'id': -1,
4476                'type': 10002,
4477                params: ['sys.float.ohos_id_text_size_body2'],
4478                'bundleName': '__harDefaultBundleName__',
4479                'moduleName': '__harDefaultModuleName__',
4480            });
4481            Text.fontWeight('regular');
4482            Text.fontColor(p6);
4483            Text.minFontScale(MIN_FONT_SCALE);
4484            Text.maxFontScale(this.decideFontScale());
4485        }, Text);
4486        Text.pop();
4487        Row.pop();
4488    }
4489
4490    builder(h6 = null) {
4491        this.observeComponentCreation2((j6, k6) => {
4492            If.create();
4493            if (this.listTreeViewMenu) {
4494                this.ifElseBranchUpdateFunction(0, () => {
4495                    this.listTreeViewMenu.bind(this)();
4496                });
4497            } else {
4498                this.ifElseBranchUpdateFunction(1, () => {
4499                });
4500            }
4501        }, If);
4502        If.pop();
4503    }
4504
4505    initialRender() {
4506        this.observeComponentCreation2((r1, s1) => {
4507            If.create();
4508            if (this.item.getNodeIsShow()) {
4509                this.ifElseBranchUpdateFunction(0, () => {
4510                    this.observeComponentCreation2((f6, g6) => {
4511                        Stack.create();
4512                        ViewStackProcessor.visualState('focused');
4513                        Stack.border({
4514                            radius: {
4515                                'id': -1,
4516                                'type': 10002,
4517                                params: ['sys.float.ohos_id_corner_radius_clicked'],
4518                                'bundleName': '__harDefaultBundleName__',
4519                                'moduleName': '__harDefaultModuleName__',
4520                            },
4521                            width: FLAG_NUMBER,
4522                            color: this.treeViewTheme.borderFocusedColor,
4523                            style: BorderStyle.Solid,
4524                        });
4525                        ViewStackProcessor.visualState('normal');
4526                        Stack.border({
4527                            radius: {
4528                                'id': -1,
4529                                'type': 10002,
4530                                params: ['sys.float.ohos_id_corner_radius_clicked'],
4531                                'bundleName': '__harDefaultBundleName__',
4532                                'moduleName': '__harDefaultModuleName__',
4533                            },
4534                            width: 0,
4535                        });
4536                        ViewStackProcessor.visualState();
4537                    }, Stack);
4538                    this.observeComponentCreation2((s5, t5) => {
4539                        Column.create();
4540                        Column.opacity(this.listNodeDataSource.getListItemOpacity(ObservedObject.GetRawObject(this.item)));
4541                        Column.onHover((e6) => {
4542                            if (e6) {
4543                                this.item.setNodeColor(this.treeViewTheme.itemHoverBgColor);
4544                            } else {
4545                                this.item.setNodeColor({
4546                                    'id': -1,
4547                                    'type': 10001,
4548                                    params: ['sys.color.ohos_id_color_background_transparent'],
4549                                    'bundleName': '__harDefaultBundleName__',
4550                                    'moduleName': '__harDefaultModuleName__',
4551                                });
4552                            }
4553                        });
4554                        Column.onTouch(this.isAccessibilityEnabled ? undefined : (d6) => {
4555                            this.onTouchNode(d6);
4556                        });
4557                        Column.backgroundColor((this.item.getNodeItem().mainTitleNode &&
4558                        this.item.getNodeItem().inputText &&
4559                        this.item.getIsShowInputText()) ? this.item.getNodeItem().inputText?.editColor :
4560                        this.item.getNodeColor());
4561                        Column.border({
4562                            width: this.item.getNodeBorder().borderWidth,
4563                            color: this.item.getNodeBorder().borderColor,
4564                            radius: this.item.getNodeBorder().borderRadius,
4565                        });
4566                        Column.height(LIST_ITEM_HEIGHT);
4567                        Column.focusable(true);
4568                        Column.onMouse((b6) => {
4569                            let c6 = this.listNodeDataSource.findIndex(this.item.getNodeCurrentNodeId());
4570                            if (b6.button === MouseButton.Right) {
4571                                this.listNodeDataSource.handleEvent(Event.MOUSE_BUTTON_RIGHT,
4572                                    this.listNodeDataSource.findIndex(this.item.getNodeCurrentNodeId()));
4573                                this.listTreeViewMenu = this.item.getMenu();
4574                                this.listNodeDataSource.setClickIndex(c6);
4575                                clearTimeout(this.item.getNodeItem().mainTitleNode?.popUpTimeout);
4576                            }
4577                            b6.stopPropagation();
4578                        });
4579                        Column.padding({ top: 0, bottom: 0 });
4580                        Column.bindPopup(this.item.getPopUpInfo().popUpIsShow, {
4581                            builder: {
4582                                builder: () => {
4583                                    this.popupForShowTitle.call(this, this.item.getPopUpInfo().popUpText,
4584                                        this.item.getPopUpInfo().popUpColor, this.item.getPopUpInfo().popUpTextColor);
4585                                }
4586                            },
4587                            placement: Placement.BottomLeft,
4588                            placementOnTop: false,
4589                            popupColor: this.item.getPopUpInfo().popUpColor,
4590                            autoCancel: true,
4591                            enableArrow: this.item.getPopUpInfo().popUpEnableArrow
4592                        });
4593                        Column.onAreaChange((y5, z5) => {
4594                            let a6 = Number.parseInt(z5.width.toString());
4595                            this.columnWidth = a6;
4596                        });
4597                    }, Column);
4598                    this.observeComponentCreation2((q5, r5) => {
4599                        Stack.create({ alignContent: Alignment.Bottom });
4600                        Stack.focusable(true);
4601                    }, Stack);
4602                    this.observeComponentCreation2((o5, p5) => {
4603                        Divider.create();
4604                        Divider.height(this.listNodeDataSource.getFlagLine().flagLineHeight);
4605                        Divider.color(this.listNodeDataSource.getFlagLine().flagLineColor);
4606                        Divider.visibility(this.listNodeDataSource.getVisibility(ObservedObject.GetRawObject(this.item)));
4607                        Divider.lineCap(LineCapStyle.Round);
4608                        Divider.margin({ start: LengthMetrics.vp(this.item.getFlagLineLeftMargin()) });
4609                        Divider.focusable(true);
4610                    }, Divider);
4611                    this.observeComponentCreation2((m5, n5) => {
4612                        Row.create({});
4613                        Row.focusable(true);
4614                        Row.width('100%');
4615                        Row.height(this.item.getNodeHeight());
4616                        Row.padding({ start: LengthMetrics.vp(this.item.getNodeLeftPadding()) });
4617                        Row.bindContextMenu({ builder: this.builder.bind(this) }, ResponseType.RightClick);
4618                    }, Row);
4619                    this.observeComponentCreation2((j5, k5) => {
4620                        Row.create();
4621                        Row.height(LIST_ITEM_HEIGHT);
4622                        Row.layoutWeight(1);
4623                        Row.focusable(true);
4624                        Row.accessibilityGroup(true);
4625                        Row.id(`treeView_node${this.item.getNodeCurrentNodeId()}`);
4626                        Row.accessibilityText(this.getAccessibilityReadText(this.item.getNodeCurrentNodeId()));
4627                        Row.accessibilityDescription(this.getAccessibilityDescription());
4628                        Row.onClick(this.isAccessibilityEnabled ? () => {
4629                            this.onClickNode();
4630                            this.callBackClick();
4631                        } : undefined);
4632                    }, Row);
4633                    this.observeComponentCreation2((j4, k4) => {
4634                        If.create();
4635                        if (this.item.getNodeItem().imageNode) {
4636                            this.ifElseBranchUpdateFunction(0, () => {
4637                                this.observeComponentCreation2((h5, i5) => {
4638                                    Row.create();
4639                                    Row.focusable(true);
4640                                    Row.backgroundColor(COLOR_IMAGE_ROW);
4641                                    Row.margin({
4642                                        end: getLengthMetricsByResourceOrNumber(this.item.getNodeItem()
4643                                            .imageNode?.itemRightMargin)
4644                                    });
4645                                    Row.height(this.item.getNodeItem().imageNode?.itemHeight *
4646                                    this.decideSymbolFontScale(this.item.symbolSource !== undefined ||
4647                                    Util.isSymbolResource(this.item.imageSource)));
4648                                    Row.width(this.item.getNodeItem().imageNode?.itemWidth *
4649                                    this.decideSymbolFontScale(this.item.symbolSource !== undefined ||
4650                                    Util.isSymbolResource(this.item.imageSource)));
4651                                }, Row);
4652                                this.observeComponentCreation2((p4, q4) => {
4653                                    If.create();
4654                                    if (this.item.symbolSource) {
4655                                        this.ifElseBranchUpdateFunction(0, () => {
4656                                            this.observeComponentCreation2((f5, g5) => {
4657                                                SymbolGlyph.create();
4658                                                SymbolGlyph.fontColor([this.getLeftIconColor()]);
4659                                                SymbolGlyph.attributeModifier.bind(this)(this.item.symbolSource);
4660                                                SymbolGlyph.fontSize(`${this.item.getNodeItem().imageNode?.itemHeight *
4661                                                this.decideSymbolFontScale(true)}vp`);
4662                                                SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE);
4663                                                SymbolGlyph.symbolEffect(new SymbolEffect(), false);
4664                                                SymbolGlyph.opacity(!this.item.getIsSelected() &&
4665                                                    !this.item.getIsHighLight() ?
4666                                                    this.item.getNodeItem().imageNode?.opacity :
4667                                                    this.item.getNodeItem().imageNode?.noOpacity);
4668                                                SymbolGlyph.focusable(this.item.getNodeItem().mainTitleNode !== null ?
4669                                                    false : true);
4670                                            }, SymbolGlyph);
4671                                        });
4672                                    } else {
4673                                        this.ifElseBranchUpdateFunction(1, () => {
4674                                            this.observeComponentCreation2((t4, u4) => {
4675                                                If.create();
4676                                                if (Util.isSymbolResource(this.item.imageSource)) {
4677                                                    this.ifElseBranchUpdateFunction(0, () => {
4678                                                        this.observeComponentCreation2((b5, c5) => {
4679                                                            SymbolGlyph.create(this.item.imageSource);
4680                                                            SymbolGlyph.fontSize(`${this.item.getNodeItem()
4681                                                                .imageNode?.itemHeight *
4682                                                            this.decideSymbolFontScale(true)}vp`);
4683                                                            SymbolGlyph.fontColor([this.getLeftIconColor()]);
4684                                                            SymbolGlyph.opacity(!this.item.getIsSelected() &&
4685                                                                !this.item.getIsHighLight() ?
4686                                                                this.item.getNodeItem().imageNode?.opacity :
4687                                                                this.item.getNodeItem().imageNode?.noOpacity);
4688                                                            SymbolGlyph.focusable(this.item.getNodeItem()
4689                                                                .mainTitleNode !== null ? false : true);
4690                                                        }, SymbolGlyph);
4691                                                    });
4692                                                } else {
4693                                                    this.ifElseBranchUpdateFunction(1, () => {
4694                                                        this.observeComponentCreation2((x4, y4) => {
4695                                                            Image.create(this.item.imageSource);
4696                                                            Image.objectFit(ImageFit.Contain);
4697                                                            Image.height(this.item.getNodeItem().imageNode?.itemHeight);
4698                                                            Image.width(this.item.getNodeItem().imageNode?.itemWidth);
4699                                                            Image.opacity(!this.item.getIsSelected() &&
4700                                                                !this.item.getIsHighLight() ?
4701                                                                this.item.getNodeItem().imageNode?.opacity :
4702                                                                this.item.getNodeItem().imageNode?.noOpacity);
4703                                                            Image.focusable(this.item.getNodeItem().mainTitleNode !==
4704                                                                null ? false : true);
4705                                                            Image.fillColor(this.getLeftIconColor());
4706                                                            Image.matchTextDirection((this.item.getNodeItem()
4707                                                                .imageCollapse?.collapseSource === ARROW_RIGHT ||
4708                                                                this.item.getNodeItem()
4709                                                                    .imageCollapse?.collapseSource ===
4710                                                                    ARROW_RIGHT_WITHE) ? true : false);
4711                                                        }, Image);
4712                                                    });
4713                                                }
4714                                            }, If);
4715                                            If.pop();
4716                                        });
4717                                    }
4718                                }, If);
4719                                If.pop();
4720                                Row.pop();
4721                            });
4722                        } else {
4723                            this.ifElseBranchUpdateFunction(1, () => {
4724                            });
4725                        }
4726                    }, If);
4727                    If.pop();
4728                    this.observeComponentCreation2((h4, i4) => {
4729                        Row.create();
4730                        Row.layoutWeight(1);
4731                        Row.focusable(true);
4732                    }, Row);
4733                    this.observeComponentCreation2((a4, b4) => {
4734                        If.create();
4735                        if (this.item.getNodeItem().mainTitleNode && this.item.getIsShowTitle()) {
4736                            this.ifElseBranchUpdateFunction(0, () => {
4737                                this.observeComponentCreation2((f4, g4) => {
4738                                    Text.create(this.item.getNodeItem().mainTitleNode?.title);
4739                                    Text.minFontScale(MIN_FONT_SCALE);
4740                                    Text.maxFontScale(this.decideFontScale());
4741                                    Text.maxLines(1);
4742                                    Text.fontSize(this.item.getNodeItem().mainTitleNode?.size);
4743                                    Text.fontColor(this.getPrimaryTextColor());
4744                                    Text.margin({
4745                                        end: getLengthMetricsByResourceOrNumber(this.item.getNodeItem()
4746                                            .mainTitleNode?.itemRightMargin)
4747                                    });
4748                                    Text.textOverflow({ overflow: TextOverflow.Ellipsis });
4749                                    Text.fontWeight(this.item.getNodeItem().mainTitleNode?.weight);
4750                                    Text.focusable(true);
4751                                }, Text);
4752                                Text.pop();
4753                            });
4754                        } else {
4755                            this.ifElseBranchUpdateFunction(1, () => {
4756                            });
4757                        }
4758                    }, If);
4759                    If.pop();
4760                    this.observeComponentCreation2((g3, h3) => {
4761                        If.create();
4762                        if (this.item.getNodeItem().mainTitleNode && this.item.getNodeItem().inputText &&
4763                        this.item.getIsShowInputText()) {
4764                            this.ifElseBranchUpdateFunction(0, () => {
4765                                this.observeComponentCreation2((y3, z3) => {
4766                                    Row.create();
4767                                    Row.backgroundColor(this.item.getNodeItem().inputText?.backgroundColor);
4768                                    Row.borderRadius(this.item.getNodeItem().inputText?.borderRadius);
4769                                    Row.margin({
4770                                        end: getLengthMetricsByResourceOrNumber(this.item.getNodeItem()
4771                                            .inputText?.itemRightMargin)
4772                                    });
4773                                }, Row);
4774                                this.observeComponentCreation2((m3, n3) => {
4775                                    TextInput.create({ text: this.item.getNodeItem().mainTitleNode?.title });
4776                                    TextInput.height(this.item.getNodeItem().inputText?.itemHeight);
4777                                    TextInput.fontSize(this.getInputTextMaxFontSize());
4778                                    TextInput.fontColor(this.item.getNodeItem().inputText?.color);
4779                                    TextInput.borderRadius(this.item.getNodeItem().inputText?.borderRadius);
4780                                    TextInput.backgroundColor(this.item.getNodeItem().inputText?.backgroundColor);
4781                                    TextInput.enterKeyType(EnterKeyType.Done);
4782                                    TextInput.focusable(true);
4783                                    TextInput.padding({
4784                                        start: LengthMetrics.resource(this.textInputPadding.left),
4785                                        end: LengthMetrics.resource(this.textInputPadding.right),
4786                                        top: LengthMetrics.resource(this.textInputPadding.top),
4787                                        bottom: LengthMetrics.resource(this.textInputPadding.bottom),
4788                                    });
4789                                    TextInput.onChange((s3) => {
4790                                        let t3 = this.listNodeDataSource.findIndex(this.item.getNodeCurrentNodeId());
4791                                        let u3 = '';
4792                                        let v3 = false;
4793                                        let w3 = false;
4794                                        if (this.checkInvalidPattern(s3)) {
4795                                            for (let x3 = 0; x3 < s3.length; x3++) {
4796                                                if (!this.checkInvalidPattern(s3[x3])) {
4797                                                    u3 += s3[x3];
4798                                                }
4799                                            }
4800                                            v3 = true;
4801                                            this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
4802                                                InputError.INVALID_ERROR, true, t3);
4803                                        } else {
4804                                            u3 = s3;
4805                                            v3 = false;
4806                                        }
4807                                        if ((this.checkIsAllCN(u3) && u3.length > this.MAX_CN_LENGTH) ||
4808                                            (!this.checkIsAllCN(u3) && u3.length > this.MAX_EN_LENGTH)) {
4809                                            u3 = this.checkIsAllCN(u3) ?
4810                                            u3.substr(0, this.MAX_CN_LENGTH) : u3.substr(0, this.MAX_EN_LENGTH);
4811                                            w3 = true;
4812                                            this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS,
4813                                                InputError.LENGTH_ERROR, true, t3);
4814                                        } else {
4815                                            w3 = false;
4816                                        }
4817                                        if (!w3 && !v3) {
4818                                            this.listNodeDataSource.setMainTitleNameOnEdit(t3, u3);
4819                                        }
4820                                    });
4821                                    TextInput.onSubmit((q3) => {
4822                                        let r3 = this.listNodeDataSource.findIndex(this.item.getNodeCurrentNodeId());
4823                                        this.listNodeDataSource.setPopUpInfo(PopUpType.WARNINGS, InputError.NONE, false,
4824                                            r3);
4825                                        this.listNodeDataSource.setItemVisibilityOnEdit(r3, MenuOperation.COMMIT_NODE);
4826                                    });
4827                                }, TextInput);
4828                                Row.pop();
4829                            });
4830                        } else {
4831                            this.ifElseBranchUpdateFunction(1, () => {
4832                            });
4833                        }
4834                    }, If);
4835                    If.pop();
4836                    this.observeComponentCreation2((e3, f3) => {
4837                        Blank.create();
4838                    }, Blank);
4839                    Blank.pop();
4840                    Row.pop();
4841                    this.observeComponentCreation2((u2, v2) => {
4842                        If.create();
4843                        if (this.listNodeDataSource.hasSubtitle(this.item.getNodeCurrentNodeId())) {
4844                            this.ifElseBranchUpdateFunction(0, () => {
4845                                this.observeComponentCreation2((c3, d3) => {
4846                                    Row.create();
4847                                    Row.focusable(true);
4848                                    Row.margin({
4849                                        start: LengthMetrics.resource(this.listNodeDataSource.getSubTitlePara().margin
4850                                            .left),
4851                                        end: this.item.getNodeItem().imageCollapse ?
4852                                        LengthMetrics.resource({
4853                                            'id': -1,
4854                                            'type': 10002,
4855                                            params: ['sys.float.padding_level0'],
4856                                            'bundleName': '__harDefaultBundleName__',
4857                                            'moduleName': '__harDefaultModuleName__',
4858                                        }) :
4859                                        LengthMetrics.resource(this.listNodeDataSource.getSubTitlePara().margin.right)
4860                                    });
4861                                }, Row);
4862                                this.observeComponentCreation2((a3, b3) => {
4863                                    Text.create(this.listNodeDataSource.getSubtitle(this.item.getNodeCurrentNodeId()));
4864                                    Text.minFontScale(MIN_FONT_SCALE);
4865                                    Text.maxFontScale(this.decideFontScale());
4866                                    Text.fontSize(this.listNodeDataSource.getSubTitlePara().fontSize);
4867                                    Text.fontColor(this.item.getIsHighLight() || this.item.getIsModify() ? {
4868                                        'id': -1,
4869                                        'type': 10001,
4870                                        params: ['sys.color.ohos_id_color_primary_contrary'],
4871                                        'bundleName': '__harDefaultBundleName__',
4872                                        'moduleName': '__harDefaultModuleName__',
4873                                    } : this.treeViewTheme.secondaryTitleFontColor);
4874                                    Text.fontWeight(this.listNodeDataSource.getSubTitlePara().fontWeight);
4875                                }, Text);
4876                                Text.pop();
4877                                Row.pop();
4878                            });
4879                        } else {
4880                            this.ifElseBranchUpdateFunction(1, () => {
4881                            });
4882                        }
4883                    }, If);
4884                    If.pop();
4885                    Row.pop();
4886                    this.observeComponentCreation2((i2, j2) => {
4887                        If.create();
4888                        if (this.item.getNodeItem().imageCollapse) {
4889                            this.ifElseBranchUpdateFunction(0, () => {
4890                                if (!If.canRetake(`treeView_button${this.item.getNodeCurrentNodeId()}`)) {
4891                                    this.observeComponentCreation2((q2, r2) => {
4892                                        Row.create();
4893                                        Row.focusable(true);
4894                                        Row.justifyContent(FlexAlign.Center);
4895                                        Row.height(this.item.getNodeItem().imageCollapse?.itemHeight *
4896                                        this.decideSymbolFontScale(true));
4897                                        Row.width(this.item.getNodeItem().imageCollapse?.itemWidth *
4898                                        this.decideSymbolFontScale(true));
4899                                        Row.onClick(() => {
4900                                            this.listNodeDataSource.expandAndCollapseNode(this.listNodeDataSource.findIndex(this.item.getNodeCurrentNodeId()));
4901                                            this.listNodeDataSource.setCurrentFocusNodeId(this.item.getNodeCurrentNodeId());
4902                                            setTimeout(() => {
4903                                                this.accessibilityRefocus();
4904                                            }, ACCESSIBILITY_REFOCUS_DELAY_TIME);
4905                                        });
4906                                        Row.id(`treeView_button${this.item.getNodeCurrentNodeId()}`);
4907                                        Row.accessibilityText(this.getAccessibilityReadButtonText(this.item.getNodeItem()
4908                                            .imageCollapse?.collapseSource === ARROW_RIGHT));
4909                                        Row.accessibilityDescription(this.getAccessibilityReadButtonDescription());
4910                                    }, Row);
4911                                    this.observeComponentCreation2((o2, p2) => {
4912                                        SymbolGlyph.create(this.item.getNodeItem().imageCollapse?.collapseSource);
4913                                        SymbolGlyph.fontSize(`${this.item.getNodeItem().imageCollapse?.itemHeight *
4914                                        this.decideSymbolFontScale(true)}vp`);
4915                                        SymbolGlyph.fontColor([this.item.getNodeItem().imageCollapse?.isCollapse ?
4916                                        this.treeViewTheme.arrowIconColor : COLOR_IMAGE_EDIT]);
4917                                        SymbolGlyph.opacity(!this.item.getIsHighLight() ?
4918                                            this.item.getNodeItem().imageCollapse?.opacity :
4919                                            this.item.getNodeItem().imageCollapse?.noOpacity);
4920                                        SymbolGlyph.focusable(true);
4921                                    }, SymbolGlyph);
4922                                    Row.pop();
4923                                }
4924                            });
4925                        } else {
4926                            this.ifElseBranchUpdateFunction(1, () => {
4927                            });
4928                        }
4929                    }, If);
4930                    If.pop();
4931                    Row.pop();
4932                    Stack.pop();
4933                    Column.pop();
4934                    Stack.pop();
4935                });
4936            } else {
4937                this.ifElseBranchUpdateFunction(1, () => {
4938                });
4939            }
4940        }, If);
4941        If.pop();
4942    }
4943
4944    rerender() {
4945        this.updateDirtyElements();
4946    }
4947}
4948
4949export class NodeItem {
4950    constructor(p1) {
4951        this.currentNodeId = p1.currentNodeId ?? -1;
4952        this.parentNodeId = p1.parentNodeId ?? -1;
4953        this.isFolder = p1.isFolder;
4954        this.nodeLevel = -1;
4955        this.indexOfParent = -1;
4956        this.childNodeInfo = { isHasChildNode: false, childNum: 0, allChildNum: 0 };
4957        this.children = [];
4958    }
4959
4960    getChildNodeInfo() {
4961        return this.childNodeInfo;
4962    }
4963
4964    getCurrentNodeId() {
4965        return this.currentNodeId;
4966    }
4967
4968    getIsFolder() {
4969        return this.isFolder;
4970    }
4971}
4972
4973class NodeBaseInfo {
4974    constructor() {
4975        this.rightMargin = -1;
4976        this.width = -1;
4977        this.height = -1;
4978    }
4979
4980    set itemWidth(o1) {
4981        this.width = o1;
4982    }
4983
4984    get itemWidth() {
4985        return this.width;
4986    }
4987
4988    set itemHeight(n1) {
4989        this.height = n1;
4990    }
4991
4992    get itemHeight() {
4993        return this.height;
4994    }
4995
4996    set itemRightMargin(m1) {
4997        this.rightMargin = m1;
4998    }
4999
5000    get itemRightMargin() {
5001        return this.rightMargin;
5002    }
5003}
5004
5005export class CollapseImageNode extends NodeBaseInfo {
5006    constructor(e1, f1, g1, h1, i1, j1, k1, l1) {
5007        super();
5008        this.rightMargin = {
5009            'id': -1,
5010            'type': 10002,
5011            params: ['sys.float.ohos_id_elements_margin_horizontal_m'],
5012            'bundleName': '__harDefaultBundleName__',
5013            'moduleName': '__harDefaultModuleName__',
5014        };
5015        this.imageSource = e1;
5016        this.symbolIconSource = f1;
5017        this.rightMargin = j1;
5018        this.imageOpacity = g1;
5019        this.itemWidth = h1;
5020        this.itemHeight = i1;
5021        this.imageCollapseSource = e1;
5022        this.symbolIconCollapseSource = f1;
5023        this.isImageCollapse = k1;
5024        this.collapseImageType = l1;
5025    }
5026
5027    get source() {
5028        return this.imageSource;
5029    }
5030
5031    get symbolSource() {
5032        return this.symbolIconSource;
5033    }
5034
5035    get opacity() {
5036        return this.imageOpacity;
5037    }
5038
5039    get noOpacity() {
5040        return 1;
5041    }
5042
5043    get collapseSource() {
5044        return this.imageCollapseSource;
5045    }
5046
5047    get symbolCollapseSource() {
5048        return this.symbolIconCollapseSource;
5049    }
5050
5051    get isCollapse() {
5052        return this.isImageCollapse;
5053    }
5054
5055    get type() {
5056        return this.collapseImageType;
5057    }
5058}
5059
5060class CollapseImageNodeFactory {
5061    constructor() {
5062    }
5063
5064    static getInstance() {
5065        if (!CollapseImageNodeFactory.instance) {
5066            CollapseImageNodeFactory.instance = new CollapseImageNodeFactory();
5067        }
5068        return CollapseImageNodeFactory.instance;
5069    }
5070
5071    createCollapseImageNodeByType(c1) {
5072        let d1;
5073        switch (c1) {
5074            case CollapseImageType.ARROW_RIGHT_WHITE:
5075                d1 = ARROW_RIGHT_WITHE;
5076                break;
5077            case CollapseImageType.ARROW_RIGHT:
5078                d1 = ARROW_RIGHT;
5079                break;
5080            case CollapseImageType.ARROW_DOWN_WHITE:
5081                d1 = ARROW_DOWN_WITHE;
5082                break;
5083            default:
5084                d1 = ARROW_DOWN;
5085        }
5086        return new CollapseImageNode(d1, undefined, {
5087            'id': -1,
5088            'type': 10002,
5089            params: ['sys.float.ohos_id_alpha_content_tertiary'],
5090            'bundleName': '__harDefaultBundleName__',
5091            'moduleName': '__harDefaultModuleName__',
5092        }, IMAGE_NODE_HEIGHT, IMAGE_NODE_WIDTH, {
5093            'id': -1,
5094            'type': 10002,
5095            params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
5096            'bundleName': '__harDefaultBundleName__',
5097            'moduleName': '__harDefaultModuleName__',
5098        }, (c1 === CollapseImageType.ARROW_RIGHT_WHITE || c1 === CollapseImageType.ARROW_DOWN_WHITE) ? false : true,
5099            c1);
5100    }
5101}
5102
5103class CollapseImageNodeFlyweightFactory {
5104    static getCollapseImageNodeByType(a1) {
5105        let b1 = CollapseImageNodeFlyweightFactory.nodeMap.get(a1);
5106        if (b1 === undefined) {
5107            b1 = CollapseImageNodeFactory.getInstance().createCollapseImageNodeByType(a1);
5108            CollapseImageNodeFlyweightFactory.nodeMap.set(a1, b1);
5109        }
5110        return b1;
5111    }
5112
5113    static getCollapseImageNode(w, x, y) {
5114        if (y === undefined) {
5115            return undefined;
5116        }
5117        let z = y;
5118        if (w == InteractionStatus.EDIT ||
5119            w === InteractionStatus.DRAG_INSERT) {
5120            if (x === NodeStatus.COLLAPSE) {
5121                z = CollapseImageType.ARROW_RIGHT_WHITE;
5122            } else {
5123                z = CollapseImageType.ARROW_DOWN_WHITE;
5124            }
5125        } else if (w === InteractionStatus.FINISH_EDIT ||
5126            w === InteractionStatus.FINISH_DRAG_INSERT) {
5127            if (x === NodeStatus.COLLAPSE) {
5128                z = CollapseImageType.ARROW_RIGHT;
5129            } else {
5130                z = CollapseImageType.ARROW_DOWN;
5131            }
5132        }
5133        return CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(z);
5134    }
5135
5136    static changeImageCollapseSource(t, u) {
5137        if (u === undefined) {
5138            return undefined;
5139        }
5140        let v;
5141        if (!u) {
5142            if (t === NodeStatus.COLLAPSE) {
5143                v = CollapseImageType.ARROW_RIGHT_WHITE;
5144            } else {
5145                v = CollapseImageType.ARROW_DOWN_WHITE;
5146            }
5147        } else {
5148            if (t === NodeStatus.COLLAPSE) {
5149                v = CollapseImageType.ARROW_RIGHT;
5150            } else {
5151                v = CollapseImageType.ARROW_DOWN;
5152            }
5153        }
5154        return CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(v);
5155    }
5156}
5157
5158CollapseImageNodeFlyweightFactory.nodeMap = new Map();
5159
5160export class ImageNode extends NodeBaseInfo {
5161    constructor(k, l, m, n, o, p, q, r, s) {
5162        super();
5163        this.rightMargin = {
5164            'id': -1,
5165            'type': 10002,
5166            params: ['sys.float.ohos_id_elements_margin_horizontal_m'],
5167            'bundleName': '__harDefaultBundleName__',
5168            'moduleName': '__harDefaultModuleName__',
5169        };
5170        this.imageSource = k;
5171        this.symbolIconSource = l;
5172        this.imageNormalSource = k;
5173        this.symbolIconNormalSource = l;
5174        if (p !== undefined) {
5175            this.imageSelectedSource = p;
5176        } else {
5177            this.imageSelectedSource = this.imageNormalSource;
5178        }
5179        this.symbolIconSelectedSource = q;
5180        if (r !== undefined) {
5181            this.imageEditSource = r;
5182        } else {
5183            this.imageEditSource = this.imageNormalSource;
5184        }
5185        this.symbolIconEditSource = s;
5186        this.imageOpacity = m;
5187        this.itemWidth = n;
5188        this.itemHeight = o;
5189        this.imageCollapseSource = k;
5190        this.imageCollapseDownSource = ARROW_DOWN;
5191        this.imageCollapseRightSource = ARROW_RIGHT;
5192        this.isImageCollapse = true;
5193        this.currentInteractionStatus = InteractionStatus.NORMAL;
5194    }
5195
5196    get source() {
5197        return this.imageSource;
5198    }
5199
5200    get symbolSource() {
5201        return this.symbolIconSource;
5202    }
5203
5204    get normalSource() {
5205        return this.imageNormalSource;
5206    }
5207
5208    get symbolNormalSource() {
5209        return this.symbolIconNormalSource;
5210    }
5211
5212    get selectedSource() {
5213        return this.imageSelectedSource;
5214    }
5215
5216    get symbolSelectedSource() {
5217        return this.symbolIconSelectedSource;
5218    }
5219
5220    get editSource() {
5221        return this.imageEditSource;
5222    }
5223
5224    get symbolEditSource() {
5225        return this.symbolIconEditSource;
5226    }
5227
5228    get opacity() {
5229        return this.imageOpacity;
5230    }
5231
5232    get noOpacity() {
5233        return 1;
5234    }
5235
5236    get collapseSource() {
5237        return this.imageCollapseSource;
5238    }
5239
5240    get isCollapse() {
5241        return this.isImageCollapse;
5242    }
5243
5244    changeImageCollapseSource(j) {
5245        if (j === NodeStatus.EXPAND) {
5246            this.imageCollapseSource = this.imageCollapseDownSource;
5247        } else if (j === NodeStatus.COLLAPSE) {
5248            this.imageCollapseSource = this.imageCollapseRightSource;
5249        }
5250    }
5251
5252    setImageCollapseSource(h, i) {
5253        if (h === InteractionStatus.EDIT || h === InteractionStatus.DRAG_INSERT) {
5254            this.imageCollapseDownSource = ARROW_DOWN_WITHE;
5255            this.imageCollapseRightSource = ARROW_RIGHT_WITHE;
5256            this.isImageCollapse = false;
5257        } else if (h === InteractionStatus.FINISH_EDIT ||
5258            h === InteractionStatus.FINISH_DRAG_INSERT) {
5259            this.imageCollapseDownSource = ARROW_DOWN;
5260            this.imageCollapseRightSource = ARROW_RIGHT;
5261            this.isImageCollapse = true;
5262        }
5263        this.imageCollapseSource = (i === NodeStatus.COLLAPSE) ?
5264        this.imageCollapseRightSource : this.imageCollapseDownSource;
5265    }
5266
5267    setImageSource(g) {
5268        switch (g) {
5269            case InteractionStatus.NORMAL:
5270                this.imageSource = this.imageNormalSource;
5271                this.symbolIconSource = this.symbolIconNormalSource;
5272                this.currentInteractionStatus = g;
5273                break;
5274            case InteractionStatus.SELECTED:
5275                if (this.currentInteractionStatus !== InteractionStatus.EDIT) {
5276                    this.imageSource = this.imageSelectedSource;
5277                    this.symbolIconSource = this.symbolIconSelectedSource;
5278                    this.currentInteractionStatus = g;
5279                }
5280                break;
5281            case InteractionStatus.EDIT:
5282                this.imageSource = this.imageEditSource;
5283                this.symbolIconSource = this.symbolIconEditSource;
5284                this.currentInteractionStatus = g;
5285                break;
5286            case InteractionStatus.FINISH_EDIT:
5287                this.imageSource = this.imageSelectedSource;
5288                this.symbolIconSource = this.symbolIconSelectedSource;
5289                this.currentInteractionStatus = g;
5290                break;
5291            case InteractionStatus.DRAG_INSERT:
5292                this.imageSource = this.imageEditSource;
5293                this.symbolIconSource = this.symbolIconEditSource;
5294                this.currentInteractionStatus = g;
5295                break;
5296            case InteractionStatus.FINISH_DRAG_INSERT:
5297                this.imageSource = this.imageNormalSource;
5298                this.symbolIconSource = this.symbolIconNormalSource;
5299                this.currentInteractionStatus = g;
5300                break;
5301            default:
5302                break;
5303        }
5304    }
5305}
5306
5307class MainTitleNode extends NodeBaseInfo {
5308    constructor(f) {
5309        super();
5310        this.treeViewTheme = TreeViewTheme.getInstance();
5311        this.mainTitleName = f;
5312        this.itemWidth = ITEM_WIDTH;
5313        this.itemHeight = ITEM_HEIGHT;
5314        this.rightMargin = {
5315            'id': -1,
5316            'type': 10002,
5317            params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
5318            'bundleName': '__harDefaultBundleName__',
5319            'moduleName': '__harDefaultModuleName__',
5320        };
5321        this.mainTitleSetting = {
5322            fontColor: this.treeViewTheme.primaryTitleFontColor,
5323            fontSize: {
5324                'id': -1,
5325                'type': 10002,
5326                params: ['sys.float.ohos_id_text_size_body1'],
5327                'bundleName': '__harDefaultBundleName__',
5328                'moduleName': '__harDefaultModuleName__',
5329            },
5330            fontWeight: FontWeight.Normal,
5331        };
5332        this.showPopUpTimeout = 0;
5333    }
5334
5335    setMainTitleSelected(e) {
5336        if (e) {
5337            this.mainTitleSetting = {
5338                fontColor: this.treeViewTheme.primaryTitleActiveFontColor,
5339                fontSize: {
5340                    'id': -1,
5341                    'type': 10002,
5342                    params: ['sys.float.ohos_id_text_size_body1'],
5343                    'bundleName': '__harDefaultBundleName__',
5344                    'moduleName': '__harDefaultModuleName__',
5345                },
5346                fontWeight: FontWeight.Regular,
5347            };
5348        } else {
5349            this.mainTitleSetting = {
5350                fontColor: this.treeViewTheme.primaryTitleFontColor,
5351                fontSize: {
5352                    'id': -1,
5353                    'type': 10002,
5354                    params: ['sys.float.ohos_id_text_size_body1'],
5355                    'bundleName': '__harDefaultBundleName__',
5356                    'moduleName': '__harDefaultModuleName__',
5357                },
5358                fontWeight: FontWeight.Normal,
5359            };
5360        }
5361    }
5362
5363    set title(d) {
5364        this.mainTitleName = d;
5365    }
5366
5367    get title() {
5368        return this.mainTitleName;
5369    }
5370
5371    set popUpTimeout(c) {
5372        this.showPopUpTimeout = c;
5373    }
5374
5375    get popUpTimeout() {
5376        return this.showPopUpTimeout;
5377    }
5378
5379    get color() {
5380        return this.mainTitleSetting.fontColor;
5381    }
5382
5383    get size() {
5384        return this.mainTitleSetting.fontSize;
5385    }
5386
5387    get weight() {
5388        return this.mainTitleSetting.fontWeight;
5389    }
5390
5391    setMainTitleHighLight(b) {
5392        if (b) {
5393            this.mainTitleSetting = {
5394                fontColor: this.treeViewTheme.primaryTitleActiveFontColor,
5395                fontSize: {
5396                    'id': -1,
5397                    'type': 10002,
5398                    params: ['sys.float.ohos_id_text_size_body1'],
5399                    'bundleName': '__harDefaultBundleName__',
5400                    'moduleName': '__harDefaultModuleName__',
5401                },
5402                fontWeight: FontWeight.Regular,
5403            };
5404        } else {
5405            this.mainTitleSetting = {
5406                fontColor: this.treeViewTheme.primaryTitleFontColor,
5407                fontSize: {
5408                    'id': -1,
5409                    'type': 10002,
5410                    params: ['sys.float.ohos_id_text_size_body1'],
5411                    'bundleName': '__harDefaultBundleName__',
5412                    'moduleName': '__harDefaultModuleName__',
5413                },
5414                fontWeight: FontWeight.Normal,
5415            };
5416        }
5417    }
5418}
5419
5420export class InputText extends NodeBaseInfo {
5421    constructor() {
5422        super();
5423        this.status = undefined;
5424        this.statusColor = {
5425            'id': -1,
5426            'type': 10001,
5427            params: ['sys.color.ohos_id_color_background'],
5428            'bundleName': '__harDefaultBundleName__',
5429            'moduleName': '__harDefaultModuleName__',
5430        };
5431        this.editItemColor = {
5432            'id': -1,
5433            'type': 10001,
5434            params: ['sys.color.ohos_id_color_emphasize'],
5435            'bundleName': '__harDefaultBundleName__',
5436            'moduleName': '__harDefaultModuleName__',
5437        };
5438        this.radius = {
5439            'id': -1,
5440            'type': 10002,
5441            params: ['sys.float.ohos_id_corner_radius_default_xs'],
5442            'bundleName': '__harDefaultBundleName__',
5443            'moduleName': '__harDefaultModuleName__',
5444        };
5445        this.treeViewTheme = TreeViewTheme.getInstance();
5446        this.itemWidth = ITEM_WIDTH;
5447        this.itemHeight = ITEM_HEIGHT_INPUT;
5448        this.rightMargin = {
5449            'id': -1,
5450            'type': 10002,
5451            params: ['sys.float.ohos_id_text_paragraph_margin_xs'],
5452            'bundleName': '__harDefaultBundleName__',
5453            'moduleName': '__harDefaultModuleName__',
5454        };
5455        this.inputTextSetting = {
5456            fontColor: this.treeViewTheme.primaryTitleFontColor,
5457            fontSize: {
5458                'id': -1,
5459                'type': 10002,
5460                params: ['sys.float.ohos_id_text_size_body1'],
5461                'bundleName': '__harDefaultBundleName__',
5462                'moduleName': '__harDefaultModuleName__',
5463            },
5464            fontWeight: FontWeight.Normal,
5465        };
5466    }
5467
5468    get color() {
5469        return this.inputTextSetting.fontColor;
5470    }
5471
5472    get size() {
5473        return this.inputTextSetting.fontSize;
5474    }
5475
5476    get weight() {
5477        return this.inputTextSetting.fontWeight;
5478    }
5479
5480    get borderRadius() {
5481        return this.radius;
5482    }
5483
5484    get backgroundColor() {
5485        return this.statusColor;
5486    }
5487
5488    get editColor() {
5489        return this.editItemColor;
5490    }
5491
5492    get textInputStatusColor() {
5493        return this.status;
5494    }
5495}
5496
5497function getLengthMetricsByResourceOrNumber(a) {
5498    if (!a) {
5499        return LengthMetrics.vp(0);
5500    } else if (typeof a === 'number') {
5501        return LengthMetrics.vp(a);
5502    } else {
5503        return LengthMetrics.resource(a);
5504    }
5505}
5506
5507export default {
5508    TreeController,
5509    TreeListener,
5510    TreeListenerManager,
5511    TreeListenType,
5512    TreeView,
5513}