• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2025 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
16const display = requireNapi('display');
17const hilog = requireNapi('hilog');
18const measure = requireNapi('measure');
19const resourceManager = requireNapi('resourceManager');
20const LengthMetrics = requireNapi('arkui.node').LengthMetrics;
21const LengthUnit = requireNapi('arkui.node').LengthUnit;
22const accessibility = requireNapi('accessibility');
23const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode;
24const i18n = requireNapi('i18n')
25
26if (!('finalizeConstruction' in ViewPU.prototype)) {
27    Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => {
28    });
29}
30
31class CustomThemeImpl {
32    constructor(colors) {
33        this.colors = colors;
34    }
35}
36const TITLE_MAX_LINES = 2;
37const HORIZON_BUTTON_MAX_COUNT = 2;
38const VERTICAL_BUTTON_MAX_COUNT = 4;
39const BUTTON_LAYOUT_WEIGHT = 1;
40const CONTENT_MAX_LINES = 2;
41const LOADING_PROGRESS_WIDTH = 40;
42const LOADING_PROGRESS_HEIGHT = 40;
43const LOADING_MAX_LINES = 10;
44const LOADING_MAX_LINES_BIG_FONT = 4;
45const LOADING_TEXT_LAYOUT_WEIGHT = 1;
46const LOADING_TEXT_MARGIN_LEFT = 12;
47const LOADING_MIN_HEIGHT = 48;
48const LIST_MIN_HEIGHT = 48;
49const CHECKBOX_CONTAINER_LENGTH = 20;
50const TEXT_MIN_HEIGHT = 48;
51const MIN_CONTENT_HEIGHT = 100;
52const MAX_CONTENT_HEIGHT = 30000;
53const KEYCODE_UP = 2012;
54const KEYCODE_DOWN = 2013;
55const IGNORE_KEY_EVENT_TYPE = 1;
56const FIRST_ITEM_INDEX = 0;
57const VERSION_TWELVE = 50000012;
58const MAX_FONT_SCALE = 2;
59const FADEOUT_GRADIENT_WIDTH = 32;
60const FADEOUT_ENABLE = 'true';
61const MAX_DIALOG_WIDTH = getNumberByResourceId(125831042, 400);
62const BUTTON_HORIZONTAL_PADDING = getNumberByResourceId(125830927, 16);
63const BODY_L = getNumberByResourceId(125830970, 16);
64const BODY_M = getNumberByResourceId(125830971, 14);
65const BODY_S = getNumberByResourceId(125830972, 12);
66const TITLE_S = getNumberByResourceId(125830966, 20);
67const PADDING_LEVEL_8 = getNumberByResourceId(125830927, 16);
68
69const BUTTON_HORIZONTAL_MARGIN = lazyInit(() => {
70    return getLengthMetricsByResource({
71        'id': -1,
72        'type': 10002,
73        params: ['sys.float.alert_right_padding_horizontal'],
74        'bundleName': '__harDefaultBundleName__',
75        'moduleName': '__harDefaultModuleName__'
76    }, 16);
77});
78const BUTTON_HORIZONTAL_SPACE = lazyInit(() => {
79    return getLengthMetricsByResource({
80        'id': -1,
81        'type': 10002,
82        params: ['sys.float.alert_button_horizontal_space'],
83        'bundleName': '__harDefaultBundleName__',
84        'moduleName': '__harDefaultModuleName__'
85    }, 8);
86});
87const BUTTON_MIN_FONT_SIZE = lazyInit(() => {
88    return getLengthMetricsByResource({
89        'id': -1,
90        'type': 10002,
91        params: ['sys.float.dialog_button_font_min_size'],
92        'bundleName': '__harDefaultBundleName__',
93        'moduleName': '__harDefaultModuleName__'
94    }, 9);
95});
96const BUTTON_MAX_FONT_SIZE = lazyInit(() => {
97    return getLengthMetricsByResource({
98        'id': -1,
99        'type': 10002,
100        params: ['sys.float.dialog_button_font_max_size'],
101        'bundleName': '__harDefaultBundleName__',
102        'moduleName': '__harDefaultModuleName__'
103    }, 16);
104});
105const DEFAULT_IMAGE_SIZE = lazyInit(() => {
106    return getLengthMetricsByResource({
107        'id': -1,
108        'type': 10002,
109        params: ['sys.float.dialog_tip_image_size'],
110        'bundleName': '__harDefaultBundleName__',
111        'moduleName': '__harDefaultModuleName__'
112    }, 64);
113});
114const DEFAULT_IMAGE_RADIUS = lazyInit(() => {
115    return getLengthMetricsByResource({
116        'id': -1,
117        'type': 10002,
118        params: ['sys.float.dialog_tip_image_radius'],
119        'bundleName': '__harDefaultBundleName__',
120        'moduleName': '__harDefaultModuleName__'
121    }, 12);
122});
123const TIP_TEXT_TOP_PADDING = lazyInit(() => {
124    return getLengthMetricsByResource({
125        'id': -1,
126        'type': 10002,
127        params: ['sys.float.dialog_tip_text_top_padding'],
128        'bundleName': '__harDefaultBundleName__',
129        'moduleName': '__harDefaultModuleName__'
130    }, 16);
131});
132const TIP_CHECKBOX_TOP_PADDING = lazyInit(() => {
133    return getLengthMetricsByResource({
134        'id': -1,
135        'type': 10002,
136        params: ['sys.float.dialog_checkbox_top_padding'],
137        'bundleName': '__harDefaultBundleName__',
138        'moduleName': '__harDefaultModuleName__'
139    }, 8);
140});
141const TIP_CHECKBOX_BOTTOM_PADDING = lazyInit(() => {
142    return getLengthMetricsByResource({
143        'id': -1,
144        'type': 10002,
145        params: ['sys.float.dialog_checkbox_bottom_padding'],
146        'bundleName': '__harDefaultBundleName__',
147        'moduleName': '__harDefaultModuleName__'
148    }, 8, true);
149});
150const TIP_CHECKBOX_END_MARGIN = lazyInit(() => {
151    return getLengthMetricsByResource({
152        'id': -1,
153        'type': 10002,
154        params: ['sys.float.dialog_checkbox_end_margin'],
155        'bundleName': '__harDefaultBundleName__',
156        'moduleName': '__harDefaultModuleName__'
157    }, 8);
158});
159const SUBTITLE_SIZE = lazyInit(() => {
160    return getLengthMetricsByResource({
161        'id': -1,
162        'type': 10002,
163        params: ['sys.float.dialog_subtitle_font_size'],
164        'bundleName': '__harDefaultBundleName__',
165        'moduleName': '__harDefaultModuleName__'
166    }, 14);
167});
168const CHECKBOX_CONTAINER_HEIGHT = lazyInit(() => {
169    return getLengthMetricsByResource({
170        'id': -1,
171        'type': 10002,
172        params: ['sys.float.dialog_checkbox_min_height'],
173        'bundleName': '__harDefaultBundleName__',
174        'moduleName': '__harDefaultModuleName__'
175    }, 48, true);
176});
177const CONTENT_END_MARGIN = lazyInit(() => {
178    return getLengthMetricsByResource({
179        'id': -1,
180        'type': 10002,
181        params: ['sys.float.dialog_content_right_margin'],
182        'bundleName': '__harDefaultBundleName__',
183        'moduleName': '__harDefaultModuleName__'
184    }, 16);
185});
186const SCROLL_END_MARGIN = lazyInit(() => {
187    return getLengthMetricsByResource({
188        'id': -1,
189        'type': 10002,
190        params: ['sys.float.dialog_scroll_right_margin'],
191        'bundleName': '__harDefaultBundleName__',
192        'moduleName': '__harDefaultModuleName__'
193    }, 16);
194});
195const DIALOG_DIVIDER_SHOW = lazyInit(() => {
196    return getLengthMetricsByResource({
197        'id': -1,
198        'type': 10002,
199        params: ['sys.float.dialog_divider_show'],
200        'bundleName': '__harDefaultBundleName__',
201        'moduleName': '__harDefaultModuleName__'
202    }, 1, true);
203});
204const ALERT_BUTTON_STYLE = lazyInit(() => {
205    return getLengthMetricsByResource({
206        'id': -1,
207        'type': 10002,
208        params: ['sys.float.alert_button_style'],
209        'bundleName': '__harDefaultBundleName__',
210        'moduleName': '__harDefaultModuleName__'
211    }, 2, true);
212});
213const ALERT_TITLE_ALIGNMENT = lazyInit(() => {
214    return getLengthMetricsByResource({
215        'id': -1,
216        'type': 10002,
217        params: ['sys.float.alert_title_alignment'],
218        'bundleName': '__harDefaultBundleName__',
219        'moduleName': '__harDefaultModuleName__'
220    }, 1);
221});
222const ERROR_BUTTON_STYLE = lazyInit(() => {
223    return getLengthMetricsByResource({
224        'id': -1,
225        'type': 10002,
226        params: ['sys.float.dialog_error_button_style'],
227        'bundleName': '__harDefaultBundleName__',
228        'moduleName': '__harDefaultModuleName__'
229    }, 2, true);
230});
231const IS_FADEOUT_ENABLE = lazyInit(() => {
232    return getString(125831120) === FADEOUT_ENABLE;
233});
234const TITLE_FONT_WEIGHT = lazyInit(() => {
235    let fontWeight = FontWeight[getString(125834679) || 'Bold'];
236    return fontWeight;
237});
238const CONTENT_FONT_WEIGHT = lazyInit(() => {
239    let fontWeight = FontWeight[getString(125834682) || 'Medium'];
240    return fontWeight;
241});
242// 'sys.string.dialog_content_font_size'
243const CONTENT_FONT_SIZE = lazyInit(() => {
244    return getLengthMetricsByResource({
245        'id': -1,
246        'type': 10002,
247        params: ['sys.float.dialog_content_font_size'],
248        'bundleName': '__harDefaultBundleName__',
249        'moduleName': '__harDefaultModuleName__'
250    }, BODY_L);
251});
252const SCROLL_BAR_OFFSET = 20;
253const SELECT_DIALOG_SCROLL_BAR_OFFSET = 4;
254export class TipsDialog extends ViewPU {
255    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
256        super(parent, __localStorage, elmtId, extraInfo);
257        if (typeof paramsLambda === 'function') {
258            this.paramsGenerator_ = paramsLambda;
259        }
260        this.controller = undefined;
261        this.imageRes = null;
262        this.__imageSize =
263            new ObservedPropertyObjectPU({ width: DEFAULT_IMAGE_SIZE(), height: DEFAULT_IMAGE_SIZE() }, this,
264                'imageSize');
265        this.title = null;
266        this.content = null;
267        this.checkAction = undefined;
268        this.onCheckedChange = undefined;
269        this.checkTips = null;
270        this.__isChecked = new ObservedPropertySimplePU(false, this, 'isChecked');
271        this.primaryButton = null;
272        this.secondaryButton = null;
273        this.buttons = undefined;
274        this.__textAlignment = new ObservedPropertySimplePU(TextAlign.Center, this, 'textAlignment');
275        this.marginOffset = 0;
276        this.contentScroller = new Scroller();
277        this.__fontColorWithTheme = new ObservedPropertyObjectPU({
278            'id': -1,
279            'type': 10001,
280            params: ['sys.color.font_primary'],
281            'bundleName': '__harDefaultBundleName__',
282            'moduleName': '__harDefaultModuleName__'
283        }, this, 'fontColorWithTheme');
284        this.theme = new CustomThemeImpl({});
285        this.themeColorMode = ThemeColorMode.SYSTEM;
286        this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale');
287        this.__minContentHeight = new ObservedPropertySimplePU(160, this, 'minContentHeight');
288        this.imageIndex = 0;
289        this.textIndex = 1;
290        this.checkBoxIndex = 2;
291        this.appMaxFontScale = 3.2;
292        this.setInitiallyProvidedValue(params);
293        this.finalizeConstruction();
294    }
295    setInitiallyProvidedValue(params) {
296        if (params.controller !== undefined) {
297            this.controller = params.controller;
298        }
299        if (params.imageRes !== undefined) {
300            this.imageRes = params.imageRes;
301        }
302        if (params.imageSize !== undefined) {
303            this.imageSize = params.imageSize;
304        }
305        if (params.title !== undefined) {
306            this.title = params.title;
307        }
308        if (params.content !== undefined) {
309            this.content = params.content;
310        }
311        if (params.checkAction !== undefined) {
312            this.checkAction = params.checkAction;
313        }
314        if (params.onCheckedChange !== undefined) {
315            this.onCheckedChange = params.onCheckedChange;
316        }
317        if (params.checkTips !== undefined) {
318            this.checkTips = params.checkTips;
319        }
320        if (params.isChecked !== undefined) {
321            this.isChecked = params.isChecked;
322        }
323        if (params.primaryButton !== undefined) {
324            this.primaryButton = params.primaryButton;
325        }
326        if (params.secondaryButton !== undefined) {
327            this.secondaryButton = params.secondaryButton;
328        }
329        if (params.buttons !== undefined) {
330            this.buttons = params.buttons;
331        }
332        if (params.textAlignment !== undefined) {
333            this.textAlignment = params.textAlignment;
334        }
335        if (params.marginOffset !== undefined) {
336            this.marginOffset = params.marginOffset;
337        }
338        if (params.contentScroller !== undefined) {
339            this.contentScroller = params.contentScroller;
340        }
341        if (params.fontColorWithTheme !== undefined) {
342            this.fontColorWithTheme = params.fontColorWithTheme;
343        }
344        if (params.theme !== undefined) {
345            this.theme = params.theme;
346        }
347        if (params.themeColorMode !== undefined) {
348            this.themeColorMode = params.themeColorMode;
349        }
350        if (params.fontSizeScale !== undefined) {
351            this.fontSizeScale = params.fontSizeScale;
352        }
353        if (params.minContentHeight !== undefined) {
354            this.minContentHeight = params.minContentHeight;
355        }
356        if (params.imageIndex !== undefined) {
357            this.imageIndex = params.imageIndex;
358        }
359        if (params.textIndex !== undefined) {
360            this.textIndex = params.textIndex;
361        }
362        if (params.checkBoxIndex !== undefined) {
363            this.checkBoxIndex = params.checkBoxIndex;
364        }
365        if (params.appMaxFontScale !== undefined) {
366            this.appMaxFontScale = params.appMaxFontScale;
367        }
368    }
369    updateStateVars(params) {
370    }
371    purgeVariableDependenciesOnElmtId(rmElmtId) {
372        this.__imageSize.purgeDependencyOnElmtId(rmElmtId);
373        this.__isChecked.purgeDependencyOnElmtId(rmElmtId);
374        this.__textAlignment.purgeDependencyOnElmtId(rmElmtId);
375        this.__fontColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
376        this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId);
377        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
378    }
379    aboutToBeDeleted() {
380        this.__imageSize.aboutToBeDeleted();
381        this.__isChecked.aboutToBeDeleted();
382        this.__textAlignment.aboutToBeDeleted();
383        this.__fontColorWithTheme.aboutToBeDeleted();
384        this.__fontSizeScale.aboutToBeDeleted();
385        this.__minContentHeight.aboutToBeDeleted();
386        SubscriberManager.Get().delete(this.id__());
387        this.aboutToBeDeletedInternal();
388    }
389    setController(ctr) {
390        this.controller = ctr;
391    }
392    get imageSize() {
393        return this.__imageSize.get();
394    }
395    set imageSize(newValue) {
396        this.__imageSize.set(newValue);
397    }
398    get isChecked() {
399        return this.__isChecked.get();
400    }
401    set isChecked(newValue) {
402        this.__isChecked.set(newValue);
403    }
404    get textAlignment() {
405        return this.__textAlignment.get();
406    }
407    set textAlignment(newValue) {
408        this.__textAlignment.set(newValue);
409    }
410    get fontColorWithTheme() {
411        return this.__fontColorWithTheme.get();
412    }
413    set fontColorWithTheme(newValue) {
414        this.__fontColorWithTheme.set(newValue);
415    }
416    get fontSizeScale() {
417        return this.__fontSizeScale.get();
418    }
419    set fontSizeScale(newValue) {
420        this.__fontSizeScale.set(newValue);
421    }
422    get minContentHeight() {
423        return this.__minContentHeight.get();
424    }
425    set minContentHeight(newValue) {
426        this.__minContentHeight.set(newValue);
427    }
428    initialRender() {
429        this.observeComponentCreation2((elmtId, isInitialRender) => {
430            __Common__.create();
431            __Common__.constraintSize({ maxHeight: '100%' });
432        }, __Common__);
433        {
434            this.observeComponentCreation2((elmtId, isInitialRender) => {
435                if (isInitialRender) {
436                    let componentCall = new CustomDialogContentComponent(this, {
437                        controller: this.controller,
438                        contentBuilder: () => {
439                            this.contentBuilder();
440                        },
441                        buttons: this.buttons,
442                        theme: this.theme,
443                        themeColorMode: this.themeColorMode,
444                        fontSizeScale: this.__fontSizeScale,
445                        minContentHeight: this.__minContentHeight,
446                    }, undefined, elmtId, () => {
447                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 174, col: 5 });
448                    ViewPU.create(componentCall);
449                    let paramsLambda = () => {
450                        return {
451                            controller: this.controller,
452                            contentBuilder: () => {
453                                this.contentBuilder();
454                            },
455                            buttons: this.buttons,
456                            theme: this.theme,
457                            themeColorMode: this.themeColorMode,
458                            fontSizeScale: this.fontSizeScale,
459                            minContentHeight: this.minContentHeight
460                        };
461                    };
462                    componentCall.paramsGenerator_ = paramsLambda;
463                } else {
464                    this.updateStateVarsOfChildByElmtId(elmtId, {});
465                }
466            }, { name: 'CustomDialogContentComponent' });
467        }
468        __Common__.pop();
469    }
470    contentBuilder(parent = null) {
471        {
472            this.observeComponentCreation2((elmtId, isInitialRender) => {
473                if (isInitialRender) {
474                    let componentCall = new TipsDialogContentLayout(this, {
475                        title: this.title,
476                        content: this.content,
477                        checkTips: this.checkTips,
478                        minContentHeight: this.__minContentHeight,
479                        dialogBuilder: () => {
480                            this.observeComponentCreation2((elmtId, isInitialRender) => {
481                                ForEach.create();
482                                const forEachItemGenFunction = _item => {
483                                    const index = _item;
484                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
485                                        If.create();
486                                        if (index === this.imageIndex) {
487                                            this.ifElseBranchUpdateFunction(0, () => {
488                                                this.imagePart.bind(this)();
489                                            });
490                                        } else if (index === this.textIndex) {
491                                            this.ifElseBranchUpdateFunction(1, () => {
492                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
493                                                    Column.create();
494                                                    Column.padding({ top: TIP_TEXT_TOP_PADDING() });
495                                                }, Column);
496                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
497                                                    WithTheme.create({
498                                                        theme: this.theme,
499                                                        colorMode: this.themeColorMode
500                                                    });
501                                                }, WithTheme);
502                                                this.textPart.bind(this)();
503                                                WithTheme.pop();
504                                                Column.pop();
505                                            });
506                                        } else {
507                                            this.ifElseBranchUpdateFunction(2, () => {
508                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
509                                                    WithTheme.create({
510                                                        theme: this.theme,
511                                                        colorMode: this.themeColorMode
512                                                    });
513                                                }, WithTheme);
514                                                this.checkBoxPart.bind(this)();
515                                                WithTheme.pop();
516                                            });
517                                        }
518                                    }, If);
519                                    If.pop();
520                                };
521                                this.forEachUpdateFunction(elmtId, [this.imageIndex, this.textIndex,
522                                    this.checkBoxIndex], forEachItemGenFunction);
523                            }, ForEach);
524                            ForEach.pop();
525                        }
526                    }, undefined, elmtId, () => {
527                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 189, col: 5 });
528                    ViewPU.create(componentCall);
529                    let paramsLambda = () => {
530                        return {
531                            title: this.title,
532                            content: this.content,
533                            checkTips: this.checkTips,
534                            minContentHeight: this.minContentHeight,
535                            dialogBuilder: () => {
536                                this.observeComponentCreation2((elmtId, isInitialRender) => {
537                                    ForEach.create();
538                                    const forEachItemGenFunction = _item => {
539                                        const index = _item;
540                                        this.observeComponentCreation2((elmtId, isInitialRender) => {
541                                            If.create();
542                                            if (index === this.imageIndex) {
543                                                this.ifElseBranchUpdateFunction(0, () => {
544                                                    this.imagePart.bind(this)();
545                                                });
546                                            } else if (index === this.textIndex) {
547                                                this.ifElseBranchUpdateFunction(1, () => {
548                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
549                                                        Column.create();
550                                                        Column.padding({ top: TIP_TEXT_TOP_PADDING() });
551                                                    }, Column);
552                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
553                                                        WithTheme.create({
554                                                            theme: this.theme,
555                                                            colorMode: this.themeColorMode
556                                                        });
557                                                    }, WithTheme);
558                                                    this.textPart.bind(this)();
559                                                    WithTheme.pop();
560                                                    Column.pop();
561                                                });
562                                            } else {
563                                                this.ifElseBranchUpdateFunction(2, () => {
564                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
565                                                        WithTheme.create({
566                                                            theme: this.theme,
567                                                            colorMode: this.themeColorMode
568                                                        });
569                                                    }, WithTheme);
570                                                    this.checkBoxPart.bind(this)();
571                                                    WithTheme.pop();
572                                                });
573                                            }
574                                        }, If);
575                                        If.pop();
576                                    };
577                                    this.forEachUpdateFunction(elmtId,
578                                        [this.imageIndex, this.textIndex, this.checkBoxIndex], forEachItemGenFunction);
579                                }, ForEach);
580                                ForEach.pop();
581                            }
582                        };
583                    };
584                    componentCall.paramsGenerator_ = paramsLambda;
585                } else {
586                    this.updateStateVarsOfChildByElmtId(elmtId, {});
587                }
588            }, { name: 'TipsDialogContentLayout' });
589        }
590    }
591    checkBoxPart(parent = null) {
592        this.observeComponentCreation2((elmtId, isInitialRender) => {
593            Row.create();
594            Row.accessibilityGroup(true);
595            Row.accessibilityText(getCheckTipsAccessibilityText(this.checkTips, this.isChecked));
596            Row.accessibilityDescription(this.isChecked ? {
597                'id': -1,
598                'type': 10003,
599                params: ['sys.string.advanced_dialog_accessibility_cancel_checked_desc'],
600                'bundleName': '__harDefaultBundleName__',
601                'moduleName': '__harDefaultModuleName__'
602            } : {
603                'id': -1,
604                'type': 10003,
605                params: ['sys.string.slider_accessibility_unselectedDesc'],
606                'bundleName': '__harDefaultBundleName__',
607                'moduleName': '__harDefaultModuleName__'
608            });
609            Row.onClick(() => {
610                this.isChecked = !this.isChecked;
611                if (this.checkAction) {
612                    this.checkAction(this.isChecked);
613                }
614                try {
615                    let eventInfo = ({
616                        type: 'announceForAccessibility',
617                        bundleName: getContext()?.abilityInfo?.bundleName,
618                        triggerAction: 'common',
619                        textAnnouncedForAccessibility: this.isChecked ?
620                        getContext().resourceManager.getStringSync(125833934) :
621                        getContext().resourceManager.getStringSync(125833935)
622                    });
623                    accessibility.sendAccessibilityEvent(eventInfo).then(() => {
624                    });
625                } catch (exception) {
626                    let code = exception.code;
627                    let message = exception.message;
628                    hilog.error(0x3900, 'Ace', `Faild to send event, cause, code: ${code}, message: ${message}`);
629                }
630            });
631            Row.padding({ top: TIP_CHECKBOX_TOP_PADDING(), bottom: TIP_CHECKBOX_BOTTOM_PADDING() });
632            Row.constraintSize({ minHeight: CHECKBOX_CONTAINER_HEIGHT() });
633            Row.width('100%');
634        }, Row);
635        this.observeComponentCreation2((elmtId, isInitialRender) => {
636            If.create();
637            if (this.checkTips !== null) {
638                this.ifElseBranchUpdateFunction(0, () => {
639                    this.observeComponentCreation2((elmtId, isInitialRender) => {
640                        Checkbox.create({ name: '', group: 'checkboxGroup' });
641                        Checkbox.select(this.isChecked);
642                        Checkbox.onChange((checked) => {
643                            this.isChecked = checked;
644                            if (this.checkAction) {
645                                this.checkAction(checked);
646                            }
647                            if (this.onCheckedChange) {
648                                this.onCheckedChange(checked);
649                            }
650                        });
651                        Checkbox.margin({
652                            start: LengthMetrics.vp(0),
653                            end: LengthMetrics.vp(TIP_CHECKBOX_END_MARGIN())
654                        });
655                    }, Checkbox);
656                    Checkbox.pop();
657                    this.observeComponentCreation2((elmtId, isInitialRender) => {
658                        Text.create(this.checkTips);
659                        Text.fontSize(`${CONTENT_FONT_SIZE()}fp`);
660                        Text.fontWeight(FontWeight.Regular);
661                        Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
662                        Text.maxLines(CONTENT_MAX_LINES);
663                        Text.layoutWeight(1);
664                        Text.focusable(false);
665                        Text.textOverflow({ overflow: TextOverflow.Ellipsis });
666                    }, Text);
667                    Text.pop();
668                });
669            } else {
670                this.ifElseBranchUpdateFunction(1, () => {
671                });
672            }
673        }, If);
674        If.pop();
675        Row.pop();
676    }
677    imagePart(parent = null) {
678        this.observeComponentCreation2((elmtId, isInitialRender) => {
679            Column.create();
680            Column.width('100%');
681        }, Column);
682        this.observeComponentCreation2((elmtId, isInitialRender) => {
683            Image.create(this.imageRes);
684            Image.objectFit(ImageFit.Contain);
685            Image.borderRadius(DEFAULT_IMAGE_RADIUS());
686            Image.constraintSize({
687                maxWidth: this.imageSize?.width ?? DEFAULT_IMAGE_SIZE(),
688                maxHeight: this.imageSize?.height ?? DEFAULT_IMAGE_SIZE()
689            });
690        }, Image);
691        Column.pop();
692    }
693    textPart(parent = null) {
694        this.observeComponentCreation2((elmtId, isInitialRender) => {
695            Scroll.create(this.contentScroller);
696            Scroll.fadingEdge(IS_FADEOUT_ENABLE(), { fadingEdgeLength: LengthMetrics.vp(FADEOUT_GRADIENT_WIDTH) });
697            Scroll.nestedScroll({
698                scrollForward: NestedScrollMode.PARALLEL,
699                scrollBackward: NestedScrollMode.PARALLEL
700            });
701            Scroll.margin({ end: LengthMetrics.vp(0 - SCROLL_BAR_OFFSET) });
702        }, Scroll);
703        this.observeComponentCreation2((elmtId, isInitialRender) => {
704            Column.create();
705            Column.margin({ end: LengthMetrics.vp(SCROLL_BAR_OFFSET) });
706            Column.width(`calc(100% - ${SCROLL_BAR_OFFSET}vp)`);
707        }, Column);
708        this.observeComponentCreation2((elmtId, isInitialRender) => {
709            If.create();
710            if (this.title !== null) {
711                this.ifElseBranchUpdateFunction(0, () => {
712                    this.observeComponentCreation2((elmtId, isInitialRender) => {
713                        Row.create();
714                        Row.padding({
715                            bottom: {
716                                'id': -1,
717                                'type': 10002,
718                                params: ['sys.float.padding_level8'],
719                                'bundleName': '__harDefaultBundleName__',
720                                'moduleName': '__harDefaultModuleName__'
721                            }
722                        });
723                    }, Row);
724                    this.observeComponentCreation2((elmtId, isInitialRender) => {
725                        Text.create(this.title);
726                        Text.fontSize(`${TITLE_S}fp`);
727                        Text.maxFontScale(Math.min(this.appMaxFontScale, MAX_FONT_SCALE));
728                        Text.fontWeight(TITLE_FONT_WEIGHT());
729                        Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
730                        Text.textAlign(TextAlign.Center);
731                        Text.maxLines(CONTENT_MAX_LINES);
732                        Text.textOverflow({ overflow: TextOverflow.Ellipsis });
733                        Text.width('100%');
734                    }, Text);
735                    Text.pop();
736                    Row.pop();
737                });
738            } else {
739                this.ifElseBranchUpdateFunction(1, () => {
740                });
741            }
742        }, If);
743        If.pop();
744        this.observeComponentCreation2((elmtId, isInitialRender) => {
745            If.create();
746            if (this.content !== null) {
747                this.ifElseBranchUpdateFunction(0, () => {
748                    this.observeComponentCreation2((elmtId, isInitialRender) => {
749                        Row.create();
750                    }, Row);
751                    this.observeComponentCreation2((elmtId, isInitialRender) => {
752                        Text.create(this.content);
753                        Text.focusable(true);
754                        Text.defaultFocus(!(this.primaryButton || this.secondaryButton));
755                        Text.focusBox({
756                            strokeWidth: LengthMetrics.px(0)
757                        });
758                        Text.fontSize(this.getContentFontSize());
759                        Text.fontWeight(CONTENT_FONT_WEIGHT());
760                        Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
761                        Text.textAlign(this.textAlignment);
762                        Text.width('100%');
763                        Text.onKeyEvent((event) => {
764                            if (event) {
765                                resolveKeyEvent(event, this.contentScroller);
766                            }
767                        });
768                    }, Text);
769                    Text.pop();
770                    Row.pop();
771                });
772            } else {
773                this.ifElseBranchUpdateFunction(1, () => {
774                });
775            }
776        }, If);
777        If.pop();
778        Column.pop();
779        Scroll.pop();
780    }
781    aboutToAppear() {
782        this.fontColorWithTheme = this.theme?.colors?.fontPrimary ?
783        this.theme.colors.fontPrimary : {
784                'id': -1,
785                'type': 10001,
786                params: ['sys.color.font_primary'],
787                'bundleName': '__harDefaultBundleName__',
788                'moduleName': '__harDefaultModuleName__'
789        };
790        let uiContext = this.getUIContext();
791        this.appMaxFontScale = uiContext.getMaxFontScale();
792        this.initButtons();
793        this.initMargin();
794    }
795    getContentFontSize() {
796        return CONTENT_FONT_SIZE() + 'fp';
797    }
798    initButtons() {
799        if (!this.primaryButton && !this.secondaryButton) {
800            return;
801        }
802        this.buttons = [];
803        if (this.primaryButton) {
804            this.buttons.push(this.primaryButton);
805        }
806        if (this.secondaryButton) {
807            this.buttons.push(this.secondaryButton);
808        }
809    }
810    initMargin() {
811        this.marginOffset = 0 - SCROLL_END_MARGIN();
812    }
813    rerender() {
814        this.updateDirtyElements();
815    }
816}
817class TipsDialogContentLayout extends ViewPU {
818    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
819        super(parent, __localStorage, elmtId, extraInfo);
820        if (typeof paramsLambda === 'function') {
821            this.paramsGenerator_ = paramsLambda;
822        }
823        this.title = null;
824        this.content = null;
825        this.checkTips = null;
826        this.__minContentHeight = new SynchedPropertySimpleTwoWayPU(params.minContentHeight, this, 'minContentHeight');
827        this.dialogBuilder = this.doNothingBuilder;
828        this.imageIndex = 0;
829        this.textIndex = 1;
830        this.checkBoxIndex = 2;
831        this.childrenSize = 3;
832        this.setInitiallyProvidedValue(params);
833        this.finalizeConstruction();
834    }
835    setInitiallyProvidedValue(params) {
836        if (params.title !== undefined) {
837            this.title = params.title;
838        }
839        if (params.content !== undefined) {
840            this.content = params.content;
841        }
842        if (params.checkTips !== undefined) {
843            this.checkTips = params.checkTips;
844        }
845        if (params.dialogBuilder !== undefined) {
846            this.dialogBuilder = params.dialogBuilder;
847        }
848        if (params.imageIndex !== undefined) {
849            this.imageIndex = params.imageIndex;
850        }
851        if (params.textIndex !== undefined) {
852            this.textIndex = params.textIndex;
853        }
854        if (params.checkBoxIndex !== undefined) {
855            this.checkBoxIndex = params.checkBoxIndex;
856        }
857        if (params.childrenSize !== undefined) {
858            this.childrenSize = params.childrenSize;
859        }
860    }
861    updateStateVars(params) {
862    }
863    purgeVariableDependenciesOnElmtId(rmElmtId) {
864        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
865    }
866    aboutToBeDeleted() {
867        this.__minContentHeight.aboutToBeDeleted();
868        SubscriberManager.Get().delete(this.id__());
869        this.aboutToBeDeletedInternal();
870    }
871    doNothingBuilder(parent = null) {
872    }
873    get minContentHeight() {
874        return this.__minContentHeight.get();
875    }
876    set minContentHeight(newValue) {
877        this.__minContentHeight.set(newValue);
878    }
879    onPlaceChildren(selfLayoutInfo, children, constraint) {
880        let currentX = 0;
881        let currentY = 0;
882        for (let index = 0; index < children.length; index++) {
883            let child = children[index];
884            child.layout({ x: currentX, y: currentY });
885            currentY += child.measureResult.height;
886        }
887    }
888    onMeasureSize(selfLayoutInfo, children, constraint) {
889        let sizeResult = { width: Number(constraint.maxWidth), height: 0 };
890        if (children.length < this.childrenSize) {
891            return sizeResult;
892        }
893        let height = 0;
894        let checkBoxHeight = 0;
895        if (this.checkTips !== null) {
896            let checkboxChild = children[this.checkBoxIndex];
897            let checkboxConstraint = {
898                maxWidth: constraint.maxWidth,
899                minHeight: CHECKBOX_CONTAINER_HEIGHT(),
900                maxHeight: constraint.maxHeight
901            };
902            let checkBoxMeasureResult = checkboxChild.measure(checkboxConstraint);
903            checkBoxHeight = checkBoxMeasureResult.height;
904            height += checkBoxHeight;
905        }
906        let imageChild = children[this.imageIndex];
907        let textMinHeight = 0;
908        if (this.title !== null || this.content !== null) {
909            textMinHeight = TEXT_MIN_HEIGHT + PADDING_LEVEL_8;
910        }
911        let imageMaxHeight = Number(constraint.maxHeight) - checkBoxHeight - textMinHeight;
912        let imageConstraint = {
913            maxWidth: constraint.maxWidth,
914            maxHeight: imageMaxHeight
915        };
916        let imageMeasureResult = imageChild.measure(imageConstraint);
917        height += imageMeasureResult.height;
918        if (this.title !== null || this.content !== null) {
919            let textChild = children[this.textIndex];
920            let contentMaxHeight = Number(constraint.maxHeight) - imageMeasureResult.height - checkBoxHeight;
921            let contentConstraint = {
922                maxWidth: constraint.maxWidth,
923                maxHeight: Math.max(contentMaxHeight, TEXT_MIN_HEIGHT)
924            };
925            let contentMeasureResult = textChild.measure(contentConstraint);
926            height += contentMeasureResult.height;
927        }
928        sizeResult.height = height;
929        this.minContentHeight = Math.max(checkBoxHeight + imageMeasureResult.height + textMinHeight,
930            MIN_CONTENT_HEIGHT);
931        return sizeResult;
932    }
933    initialRender() {
934        this.dialogBuilder.bind(this)();
935    }
936    rerender() {
937        this.updateDirtyElements();
938    }
939}
940export class SelectDialog extends ViewPU {
941    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
942        super(parent, __localStorage, elmtId, extraInfo);
943        if (typeof paramsLambda === 'function') {
944            this.paramsGenerator_ = paramsLambda;
945        }
946        this.controller = undefined;
947        this.title = '';
948        this.content = '';
949        this.confirm = null;
950        this.radioContent = [];
951        this.buttons = [];
952        this.contentPadding = undefined;
953        this.isFocus = false;
954        this.currentFocusIndex = -1;
955        this.radioHeight = 0;
956        this.itemHeight = 0;
957        this.__selectedIndex = new ObservedPropertySimplePU(-1, this, 'selectedIndex');
958        this.contentBuilder = this.buildContent;
959        this.__fontColorWithTheme = new ObservedPropertyObjectPU({
960            'id': -1,
961            'type': 10001,
962            params: ['sys.color.font_primary'],
963            'bundleName': '__harDefaultBundleName__',
964            'moduleName': '__harDefaultModuleName__'
965        }, this, 'fontColorWithTheme');
966        this.__dividerColorWithTheme = new ObservedPropertyObjectPU({
967            'id': -1,
968            'type': 10001,
969            params: ['sys.color.comp_divider'],
970            'bundleName': '__harDefaultBundleName__',
971            'moduleName': '__harDefaultModuleName__'
972        }, this, 'dividerColorWithTheme');
973        this.theme = new CustomThemeImpl({});
974        this.themeColorMode = ThemeColorMode.SYSTEM;
975        this.contentScroller = new Scroller();
976        this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale');
977        this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight');
978        this.setInitiallyProvidedValue(params);
979        this.finalizeConstruction();
980    }
981    setInitiallyProvidedValue(params) {
982        if (params.controller !== undefined) {
983            this.controller = params.controller;
984        }
985        if (params.title !== undefined) {
986            this.title = params.title;
987        }
988        if (params.content !== undefined) {
989            this.content = params.content;
990        }
991        if (params.confirm !== undefined) {
992            this.confirm = params.confirm;
993        }
994        if (params.radioContent !== undefined) {
995            this.radioContent = params.radioContent;
996        }
997        if (params.buttons !== undefined) {
998            this.buttons = params.buttons;
999        }
1000        if (params.contentPadding !== undefined) {
1001            this.contentPadding = params.contentPadding;
1002        }
1003        if (params.isFocus !== undefined) {
1004            this.isFocus = params.isFocus;
1005        }
1006        if (params.currentFocusIndex !== undefined) {
1007            this.currentFocusIndex = params.currentFocusIndex;
1008        }
1009        if (params.radioHeight !== undefined) {
1010            this.radioHeight = params.radioHeight;
1011        }
1012        if (params.itemHeight !== undefined) {
1013            this.itemHeight = params.itemHeight;
1014        }
1015        if (params.selectedIndex !== undefined) {
1016            this.selectedIndex = params.selectedIndex;
1017        }
1018        if (params.contentBuilder !== undefined) {
1019            this.contentBuilder = params.contentBuilder;
1020        }
1021        if (params.fontColorWithTheme !== undefined) {
1022            this.fontColorWithTheme = params.fontColorWithTheme;
1023        }
1024        if (params.dividerColorWithTheme !== undefined) {
1025            this.dividerColorWithTheme = params.dividerColorWithTheme;
1026        }
1027        if (params.theme !== undefined) {
1028            this.theme = params.theme;
1029        }
1030        if (params.themeColorMode !== undefined) {
1031            this.themeColorMode = params.themeColorMode;
1032        }
1033        if (params.contentScroller !== undefined) {
1034            this.contentScroller = params.contentScroller;
1035        }
1036        if (params.fontSizeScale !== undefined) {
1037            this.fontSizeScale = params.fontSizeScale;
1038        }
1039        if (params.minContentHeight !== undefined) {
1040            this.minContentHeight = params.minContentHeight;
1041        }
1042    }
1043    updateStateVars(params) {
1044    }
1045    purgeVariableDependenciesOnElmtId(rmElmtId) {
1046        this.__selectedIndex.purgeDependencyOnElmtId(rmElmtId);
1047        this.__fontColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
1048        this.__dividerColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
1049        this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId);
1050        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
1051    }
1052    aboutToBeDeleted() {
1053        this.__selectedIndex.aboutToBeDeleted();
1054        this.__fontColorWithTheme.aboutToBeDeleted();
1055        this.__dividerColorWithTheme.aboutToBeDeleted();
1056        this.__fontSizeScale.aboutToBeDeleted();
1057        this.__minContentHeight.aboutToBeDeleted();
1058        SubscriberManager.Get().delete(this.id__());
1059        this.aboutToBeDeletedInternal();
1060    }
1061    setController(ctr) {
1062        this.controller = ctr;
1063    }
1064    get selectedIndex() {
1065        return this.__selectedIndex.get();
1066    }
1067    set selectedIndex(newValue) {
1068        this.__selectedIndex.set(newValue);
1069    }
1070    get fontColorWithTheme() {
1071        return this.__fontColorWithTheme.get();
1072    }
1073    set fontColorWithTheme(newValue) {
1074        this.__fontColorWithTheme.set(newValue);
1075    }
1076    get dividerColorWithTheme() {
1077        return this.__dividerColorWithTheme.get();
1078    }
1079    set dividerColorWithTheme(newValue) {
1080        this.__dividerColorWithTheme.set(newValue);
1081    }
1082    get fontSizeScale() {
1083        return this.__fontSizeScale.get();
1084    }
1085    set fontSizeScale(newValue) {
1086        this.__fontSizeScale.set(newValue);
1087    }
1088    get minContentHeight() {
1089        return this.__minContentHeight.get();
1090    }
1091    set minContentHeight(newValue) {
1092        this.__minContentHeight.set(newValue);
1093    }
1094    buildContent(parent = null) {
1095        this.observeComponentCreation2((elmtId, isInitialRender) => {
1096            Scroll.create(this.contentScroller);
1097            Scroll.scrollBar(BarState.Auto);
1098            Scroll.nestedScroll({ scrollForward: NestedScrollMode.PARALLEL, scrollBackward: NestedScrollMode.PARALLEL });
1099            Scroll.onDidScroll((xOffset, yOffset) => {
1100                let scrollHeight = (this.itemHeight - this.radioHeight) / 2;
1101                if (this.isFocus) {
1102                    if (this.currentFocusIndex === this.radioContent.length - 1) {
1103                        this.contentScroller.scrollEdge(Edge.Bottom);
1104                        this.currentFocusIndex = -1;
1105                    } else if (this.currentFocusIndex === FIRST_ITEM_INDEX) {
1106                        this.contentScroller.scrollEdge(Edge.Top);
1107                        this.currentFocusIndex = -1;
1108                    } else {
1109                        if (yOffset > 0) {
1110                            this.contentScroller.scrollBy(0, scrollHeight);
1111                        } else if (yOffset < 0) {
1112                            this.contentScroller.scrollBy(0, 0 - scrollHeight);
1113                        }
1114                    }
1115                    this.isFocus = false;
1116                }
1117            });
1118            Scroll.margin({ end: LengthMetrics.vp(SELECT_DIALOG_SCROLL_BAR_OFFSET) });
1119        }, Scroll);
1120        this.observeComponentCreation2((elmtId, isInitialRender) => {
1121            Column.create();
1122        }, Column);
1123        this.observeComponentCreation2((elmtId, isInitialRender) => {
1124            If.create();
1125            if (this.content) {
1126                this.ifElseBranchUpdateFunction(0, () => {
1127                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1128                        Row.create();
1129                        Row.padding({
1130                            left: {
1131                                'id': -1,
1132                                'type': 10002,
1133                                params: ['sys.float.padding_level12'],
1134                                'bundleName': '__harDefaultBundleName__',
1135                                'moduleName': '__harDefaultModuleName__'
1136                            },
1137                            right: {
1138                                'id': -1,
1139                                'type': 10002,
1140                                params: ['sys.float.padding_level12'],
1141                                'bundleName': '__harDefaultBundleName__',
1142                                'moduleName': '__harDefaultModuleName__'
1143                            },
1144                            bottom: {
1145                                'id': -1,
1146                                'type': 10002,
1147                                params: ['sys.float.padding_level4'],
1148                                'bundleName': '__harDefaultBundleName__',
1149                                'moduleName': '__harDefaultModuleName__'
1150                            }
1151                        });
1152                        Row.width('100%');
1153                    }, Row);
1154                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1155                        Text.create(this.content);
1156                        Text.fontSize(`${BODY_M}fp`);
1157                        Text.fontWeight(FontWeight.Regular);
1158                        Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
1159                        Text.textOverflow({ overflow: TextOverflow.Ellipsis });
1160                    }, Text);
1161                    Text.pop();
1162                    Row.pop();
1163                });
1164            } else {
1165                this.ifElseBranchUpdateFunction(1, () => {
1166                });
1167            }
1168        }, If);
1169        If.pop();
1170        this.observeComponentCreation2((elmtId, isInitialRender) => {
1171            List.create();
1172            List.width('100%');
1173            List.clip(false);
1174            List.onFocus(() => {
1175                if (!this.contentScroller.isAtEnd()) {
1176                    this.contentScroller.scrollEdge(Edge.Top);
1177                    focusControl.requestFocus(String(FIRST_ITEM_INDEX));
1178                }
1179            });
1180            List.defaultFocus(this.buttons?.length === 0 ? true : false);
1181        }, List);
1182        this.observeComponentCreation2((elmtId, isInitialRender) => {
1183            ForEach.create();
1184            const forEachItemGenFunction = (_item, index) => {
1185                const item = _item;
1186                {
1187                    const itemCreation = (elmtId, isInitialRender) => {
1188                        ViewStackProcessor.StartGetAccessRecordingFor(elmtId);
1189                        itemCreation2(elmtId, isInitialRender);
1190                        if (!isInitialRender) {
1191                            ListItem.pop();
1192                        }
1193                        ViewStackProcessor.StopGetAccessRecording();
1194                    };
1195                    const itemCreation2 = (elmtId, isInitialRender) => {
1196                        ListItem.create(deepRenderFunction, true);
1197                        ListItem.padding({
1198                            left: {
1199                                'id': -1,
1200                                'type': 10002,
1201                                params: ['sys.float.padding_level6'],
1202                                'bundleName': '__harDefaultBundleName__',
1203                                'moduleName': '__harDefaultModuleName__'
1204                            },
1205                            right: {
1206                                'id': -1,
1207                                'type': 10002,
1208                                params: ['sys.float.padding_level6'],
1209                                'bundleName': '__harDefaultBundleName__',
1210                                'moduleName': '__harDefaultModuleName__'
1211                            }
1212                        });
1213                        ListItem.onSizeChange((oldValue, newValue) => {
1214                            this.itemHeight = Number(newValue.height);
1215                        });
1216                    };
1217                    const deepRenderFunction = (elmtId, isInitialRender) => {
1218                        itemCreation(elmtId, isInitialRender);
1219                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1220                            Column.create();
1221                            Column.borderRadius({
1222                                'id': -1,
1223                                'type': 10002,
1224                                params: ['sys.float.corner_radius_level8'],
1225                                'bundleName': '__harDefaultBundleName__',
1226                                'moduleName': '__harDefaultModuleName__'
1227                            });
1228                            Column.focusBox({
1229                                margin: { value: -2, unit: LengthUnit.VP }
1230                            });
1231                            Column.accessibilityText(getAccessibilityText(item.title, this.selectedIndex === index));
1232                            Column.onClick(() => {
1233                                this.selectedIndex = index;
1234                                item.action && item.action();
1235                                closeDialog(this.controller, 'onClick');
1236                            });
1237                        }, Column);
1238                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1239                            Button.createWithChild();
1240                            Button.type(ButtonType.Normal);
1241                            Button.borderRadius({
1242                                'id': -1,
1243                                'type': 10002,
1244                                params: ['sys.float.corner_radius_level8'],
1245                                'bundleName': '__harDefaultBundleName__',
1246                                'moduleName': '__harDefaultModuleName__'
1247                            });
1248                            Button.buttonStyle(ButtonStyleMode.TEXTUAL);
1249                            Button.padding({
1250                                left: {
1251                                    'id': -1,
1252                                    'type': 10002,
1253                                    params: ['sys.float.padding_level6'],
1254                                    'bundleName': '__harDefaultBundleName__',
1255                                    'moduleName': '__harDefaultModuleName__'
1256                                },
1257                                right: {
1258                                    'id': -1,
1259                                    'type': 10002,
1260                                    params: ['sys.float.padding_level6'],
1261                                    'bundleName': '__harDefaultBundleName__',
1262                                    'moduleName': '__harDefaultModuleName__'
1263                                }
1264                            });
1265                        }, Button);
1266                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1267                            Row.create();
1268                            Row.constraintSize({ minHeight: LIST_MIN_HEIGHT });
1269                            Row.clip(false);
1270                            Row.padding({
1271                                top: {
1272                                    'id': -1,
1273                                    'type': 10002,
1274                                    params: ['sys.float.padding_level4'],
1275                                    'bundleName': '__harDefaultBundleName__',
1276                                    'moduleName': '__harDefaultModuleName__'
1277                                },
1278                                bottom: {
1279                                    'id': -1,
1280                                    'type': 10002,
1281                                    params: ['sys.float.padding_level4'],
1282                                    'bundleName': '__harDefaultBundleName__',
1283                                    'moduleName': '__harDefaultModuleName__'
1284                                }
1285                            });
1286                        }, Row);
1287                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1288                            Text.create(item.title);
1289                            Text.fontSize(`${BODY_L}fp`);
1290                            Text.fontWeight(FontWeight.Medium);
1291                            Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
1292                            Text.layoutWeight(1);
1293                            Text.direction(i18n.isRTL(i18n.System.getSystemLanguage()) ? Direction.Rtl : Direction.Ltr);
1294                        }, Text);
1295                        Text.pop();
1296                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1297                            Radio.create({ value: 'item.title', group: 'radioGroup' });
1298                            Radio.size({ width: CHECKBOX_CONTAINER_LENGTH, height: CHECKBOX_CONTAINER_LENGTH });
1299                            Radio.checked(this.selectedIndex === index);
1300                            Radio.hitTestBehavior(HitTestMode.None);
1301                            Radio.id(String(index));
1302                            Radio.focusable(false);
1303                            Radio.accessibilityLevel('no');
1304                            Radio.visibility(this.selectedIndex === index ? Visibility.Visible : Visibility.Hidden);
1305                            Radio.radioStyle({ uncheckedBorderColor: Color.Transparent });
1306                            Radio.onFocus(() => {
1307                                this.isFocus = true;
1308                                this.currentFocusIndex = index;
1309                                if (index === FIRST_ITEM_INDEX) {
1310                                    this.contentScroller.scrollEdge(Edge.Top);
1311                                } else if (index === this.radioContent.length - 1) {
1312                                    this.contentScroller.scrollEdge(Edge.Bottom);
1313                                }
1314                            });
1315                            Radio.onSizeChange((oldValue, newValue) => {
1316                                this.radioHeight = Number(newValue.height);
1317                            });
1318                        }, Radio);
1319                        Row.pop();
1320                        Button.pop();
1321                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1322                            If.create();
1323                            if (index < this.radioContent.length - 1) {
1324                                this.ifElseBranchUpdateFunction(0, () => {
1325                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1326                                        Divider.create();
1327                                        Divider.color(ObservedObject.GetRawObject(this.dividerColorWithTheme));
1328                                        Divider.padding({
1329                                            left: {
1330                                                'id': -1,
1331                                                'type': 10002,
1332                                                params: ['sys.float.padding_level6'],
1333                                                'bundleName': '__harDefaultBundleName__',
1334                                                'moduleName': '__harDefaultModuleName__'
1335                                            },
1336                                            right: {
1337                                                'id': -1,
1338                                                'type': 10002,
1339                                                params: ['sys.float.padding_level6'],
1340                                                'bundleName': '__harDefaultBundleName__',
1341                                                'moduleName': '__harDefaultModuleName__'
1342                                            }
1343                                        });
1344                                    }, Divider);
1345                                });
1346                            } else {
1347                                this.ifElseBranchUpdateFunction(1, () => {
1348                                });
1349                            }
1350                        }, If);
1351                        If.pop();
1352                        Column.pop();
1353                        ListItem.pop();
1354                    };
1355                    this.observeComponentCreation2(itemCreation2, ListItem);
1356                    ListItem.pop();
1357                }
1358            };
1359            this.forEachUpdateFunction(elmtId, this.radioContent, forEachItemGenFunction, undefined, true, false);
1360        }, ForEach);
1361        ForEach.pop();
1362        List.pop();
1363        Column.pop();
1364        Scroll.pop();
1365    }
1366    initialRender() {
1367        this.observeComponentCreation2((elmtId, isInitialRender) => {
1368            __Common__.create();
1369            __Common__.constraintSize({ maxHeight: '100%' });
1370        }, __Common__);
1371        {
1372            this.observeComponentCreation2((elmtId, isInitialRender) => {
1373                if (isInitialRender) {
1374                    let componentCall = new CustomDialogContentComponent(this, {
1375                        controller: this.controller,
1376                        primaryTitle: this.title,
1377                        contentBuilder: () => {
1378                            this.contentBuilder();
1379                        },
1380                        buttons: this.buttons,
1381                        contentAreaPadding: this.contentPadding,
1382                        theme: this.theme,
1383                        themeColorMode: this.themeColorMode,
1384                        fontSizeScale: this.__fontSizeScale,
1385                        minContentHeight: this.__minContentHeight,
1386                    }, undefined, elmtId, () => {
1387                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 589, col: 5 });
1388                    ViewPU.create(componentCall);
1389                    let paramsLambda = () => {
1390                        return {
1391                            controller: this.controller,
1392                            primaryTitle: this.title,
1393                            contentBuilder: () => {
1394                                this.contentBuilder();
1395                            },
1396                            buttons: this.buttons,
1397                            contentAreaPadding: this.contentPadding,
1398                            theme: this.theme,
1399                            themeColorMode: this.themeColorMode,
1400                            fontSizeScale: this.fontSizeScale,
1401                            minContentHeight: this.minContentHeight
1402                        };
1403                    };
1404                    componentCall.paramsGenerator_ = paramsLambda;
1405                } else {
1406                    this.updateStateVarsOfChildByElmtId(elmtId, {});
1407                }
1408            }, { name: 'CustomDialogContentComponent' });
1409        }
1410        __Common__.pop();
1411    }
1412    aboutToAppear() {
1413        this.fontColorWithTheme = this.theme?.colors?.fontPrimary ?
1414        this.theme.colors.fontPrimary : {
1415                'id': -1,
1416                'type': 10001,
1417                params: ['sys.color.font_primary'],
1418                'bundleName': '__harDefaultBundleName__',
1419                'moduleName': '__harDefaultModuleName__'
1420            };
1421        this.dividerColorWithTheme = this.theme?.colors?.compDivider ?
1422        this.theme.colors.compDivider : {
1423                'id': -1,
1424                'type': 10001,
1425                params: ['sys.color.comp_divider'],
1426                'bundleName': '__harDefaultBundleName__',
1427                'moduleName': '__harDefaultModuleName__'
1428            };
1429        this.initContentPadding();
1430        this.initButtons();
1431    }
1432    initContentPadding() {
1433        this.contentPadding = {
1434            left: {
1435                'id': -1,
1436                'type': 10002,
1437                params: ['sys.float.padding_level0'],
1438                'bundleName': '__harDefaultBundleName__',
1439                'moduleName': '__harDefaultModuleName__'
1440            },
1441            right: {
1442                'id': -1,
1443                'type': 10002,
1444                params: ['sys.float.padding_level0'],
1445                'bundleName': '__harDefaultBundleName__',
1446                'moduleName': '__harDefaultModuleName__'
1447            }
1448        };
1449        if (!this.title && !this.confirm) {
1450            this.contentPadding = {
1451                top: {
1452                    'id': -1,
1453                    'type': 10002,
1454                    params: ['sys.float.padding_level12'],
1455                    'bundleName': '__harDefaultBundleName__',
1456                    'moduleName': '__harDefaultModuleName__'
1457                },
1458                bottom: {
1459                    'id': -1,
1460                    'type': 10002,
1461                    params: ['sys.float.padding_level12'],
1462                    'bundleName': '__harDefaultBundleName__',
1463                    'moduleName': '__harDefaultModuleName__'
1464                }
1465            };
1466            return;
1467        }
1468        if (!this.title) {
1469            this.contentPadding = {
1470                top: {
1471                    'id': -1,
1472                    'type': 10002,
1473                    params: ['sys.float.padding_level12'],
1474                    'bundleName': '__harDefaultBundleName__',
1475                    'moduleName': '__harDefaultModuleName__'
1476                }
1477            };
1478        } else if (!this.confirm) {
1479            this.contentPadding = {
1480                bottom: {
1481                    'id': -1,
1482                    'type': 10002,
1483                    params: ['sys.float.padding_level12'],
1484                    'bundleName': '__harDefaultBundleName__',
1485                    'moduleName': '__harDefaultModuleName__'
1486                }
1487            };
1488        }
1489    }
1490    initButtons() {
1491        this.buttons = [];
1492        if (this.confirm) {
1493            this.buttons.push(this.confirm);
1494        }
1495    }
1496    rerender() {
1497        this.updateDirtyElements();
1498    }
1499}
1500class ConfirmDialogContentLayout extends ViewPU {
1501    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
1502        super(parent, __localStorage, elmtId, extraInfo);
1503        if (typeof paramsLambda === 'function') {
1504            this.paramsGenerator_ = paramsLambda;
1505        }
1506        this.textIndex = 0;
1507        this.checkboxIndex = 1;
1508        this.__minContentHeight = new SynchedPropertySimpleTwoWayPU(params.minContentHeight, this, 'minContentHeight');
1509        this.dialogBuilder = this.doNothingBuilder;
1510        this.setInitiallyProvidedValue(params);
1511        this.finalizeConstruction();
1512    }
1513    setInitiallyProvidedValue(params) {
1514        if (params.textIndex !== undefined) {
1515            this.textIndex = params.textIndex;
1516        }
1517        if (params.checkboxIndex !== undefined) {
1518            this.checkboxIndex = params.checkboxIndex;
1519        }
1520        if (params.dialogBuilder !== undefined) {
1521            this.dialogBuilder = params.dialogBuilder;
1522        }
1523    }
1524    updateStateVars(params) {
1525    }
1526    purgeVariableDependenciesOnElmtId(rmElmtId) {
1527        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
1528    }
1529    aboutToBeDeleted() {
1530        this.__minContentHeight.aboutToBeDeleted();
1531        SubscriberManager.Get().delete(this.id__());
1532        this.aboutToBeDeletedInternal();
1533    }
1534    get minContentHeight() {
1535        return this.__minContentHeight.get();
1536    }
1537    set minContentHeight(newValue) {
1538        this.__minContentHeight.set(newValue);
1539    }
1540    doNothingBuilder(parent = null) {
1541    }
1542    onPlaceChildren(selfLayoutInfo, children, constraint) {
1543        let currentX = 0;
1544        let currentY = 0;
1545        for (let index = 0; index < children.length; index++) {
1546            let child = children[index];
1547            child.layout({ x: currentX, y: currentY });
1548            currentY += child.measureResult.height;
1549        }
1550    }
1551    onMeasureSize(selfLayoutInfo, children, constraint) {
1552        let sizeResult = { width: Number(constraint.maxWidth), height: 0 };
1553        let childrenSize = 2;
1554        if (children.length < childrenSize) {
1555            return sizeResult;
1556        }
1557        let height = 0;
1558        let checkboxChild = children[this.checkboxIndex];
1559        let checkboxConstraint = {
1560            maxWidth: constraint.maxWidth,
1561            minHeight: CHECKBOX_CONTAINER_HEIGHT(),
1562            maxHeight: constraint.maxHeight
1563        };
1564        let checkBoxMeasureResult = checkboxChild.measure(checkboxConstraint);
1565        height += checkBoxMeasureResult.height;
1566        let textChild = children[this.textIndex];
1567        let textConstraint = {
1568            maxWidth: constraint.maxWidth,
1569            maxHeight: Number(constraint.maxHeight) - height
1570        };
1571        let textMeasureResult = textChild.measure(textConstraint);
1572        height += textMeasureResult.height;
1573        sizeResult.height = height;
1574        this.minContentHeight = Math.max(checkBoxMeasureResult.height + TEXT_MIN_HEIGHT, MIN_CONTENT_HEIGHT);
1575        return sizeResult;
1576    }
1577    initialRender() {
1578        this.dialogBuilder.bind(this)();
1579    }
1580    rerender() {
1581        this.updateDirtyElements();
1582    }
1583}
1584export class ConfirmDialog extends ViewPU {
1585    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
1586        super(parent, __localStorage, elmtId, extraInfo);
1587        if (typeof paramsLambda === 'function') {
1588            this.paramsGenerator_ = paramsLambda;
1589        }
1590        this.controller = undefined;
1591        this.title = '';
1592        this.content = '';
1593        this.checkTips = '';
1594        this.__isChecked = new ObservedPropertySimplePU(false, this, 'isChecked');
1595        this.primaryButton = null;
1596        this.secondaryButton = null;
1597        this.__fontColorWithTheme = new ObservedPropertyObjectPU({
1598            'id': -1,
1599            'type': 10001,
1600            params: ['sys.color.font_primary'],
1601            'bundleName': '__harDefaultBundleName__',
1602            'moduleName': '__harDefaultModuleName__'
1603        }, this, 'fontColorWithTheme');
1604        this.theme = new CustomThemeImpl({});
1605        this.themeColorMode = ThemeColorMode.SYSTEM;
1606        this.onCheckedChange = undefined;
1607        this.contentScroller = new Scroller();
1608        this.buttons = undefined;
1609        this.__textAlign = new ObservedPropertySimplePU(TextAlign.Center, this, 'textAlign');
1610        this.marginOffset = 0;
1611        this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale');
1612        this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight');
1613        this.textIndex = 0;
1614        this.checkboxIndex = 1;
1615        this.setInitiallyProvidedValue(params);
1616        this.finalizeConstruction();
1617    }
1618    setInitiallyProvidedValue(params) {
1619        if (params.controller !== undefined) {
1620            this.controller = params.controller;
1621        }
1622        if (params.title !== undefined) {
1623            this.title = params.title;
1624        }
1625        if (params.content !== undefined) {
1626            this.content = params.content;
1627        }
1628        if (params.checkTips !== undefined) {
1629            this.checkTips = params.checkTips;
1630        }
1631        if (params.isChecked !== undefined) {
1632            this.isChecked = params.isChecked;
1633        }
1634        if (params.primaryButton !== undefined) {
1635            this.primaryButton = params.primaryButton;
1636        }
1637        if (params.secondaryButton !== undefined) {
1638            this.secondaryButton = params.secondaryButton;
1639        }
1640        if (params.fontColorWithTheme !== undefined) {
1641            this.fontColorWithTheme = params.fontColorWithTheme;
1642        }
1643        if (params.theme !== undefined) {
1644            this.theme = params.theme;
1645        }
1646        if (params.themeColorMode !== undefined) {
1647            this.themeColorMode = params.themeColorMode;
1648        }
1649        if (params.onCheckedChange !== undefined) {
1650            this.onCheckedChange = params.onCheckedChange;
1651        }
1652        if (params.contentScroller !== undefined) {
1653            this.contentScroller = params.contentScroller;
1654        }
1655        if (params.buttons !== undefined) {
1656            this.buttons = params.buttons;
1657        }
1658        if (params.textAlign !== undefined) {
1659            this.textAlign = params.textAlign;
1660        }
1661        if (params.marginOffset !== undefined) {
1662            this.marginOffset = params.marginOffset;
1663        }
1664        if (params.fontSizeScale !== undefined) {
1665            this.fontSizeScale = params.fontSizeScale;
1666        }
1667        if (params.minContentHeight !== undefined) {
1668            this.minContentHeight = params.minContentHeight;
1669        }
1670        if (params.textIndex !== undefined) {
1671            this.textIndex = params.textIndex;
1672        }
1673        if (params.checkboxIndex !== undefined) {
1674            this.checkboxIndex = params.checkboxIndex;
1675        }
1676    }
1677    updateStateVars(params) {
1678    }
1679    purgeVariableDependenciesOnElmtId(rmElmtId) {
1680        this.__isChecked.purgeDependencyOnElmtId(rmElmtId);
1681        this.__fontColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
1682        this.__textAlign.purgeDependencyOnElmtId(rmElmtId);
1683        this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId);
1684        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
1685    }
1686    aboutToBeDeleted() {
1687        this.__isChecked.aboutToBeDeleted();
1688        this.__fontColorWithTheme.aboutToBeDeleted();
1689        this.__textAlign.aboutToBeDeleted();
1690        this.__fontSizeScale.aboutToBeDeleted();
1691        this.__minContentHeight.aboutToBeDeleted();
1692        SubscriberManager.Get().delete(this.id__());
1693        this.aboutToBeDeletedInternal();
1694    }
1695    setController(ctr) {
1696        this.controller = ctr;
1697    }
1698    get isChecked() {
1699        return this.__isChecked.get();
1700    }
1701    set isChecked(newValue) {
1702        this.__isChecked.set(newValue);
1703    }
1704    get fontColorWithTheme() {
1705        return this.__fontColorWithTheme.get();
1706    }
1707    set fontColorWithTheme(newValue) {
1708        this.__fontColorWithTheme.set(newValue);
1709    }
1710    get textAlign() {
1711        return this.__textAlign.get();
1712    }
1713    set textAlign(newValue) {
1714        this.__textAlign.set(newValue);
1715    }
1716    get fontSizeScale() {
1717        return this.__fontSizeScale.get();
1718    }
1719    set fontSizeScale(newValue) {
1720        this.__fontSizeScale.set(newValue);
1721    }
1722    get minContentHeight() {
1723        return this.__minContentHeight.get();
1724    }
1725    set minContentHeight(newValue) {
1726        this.__minContentHeight.set(newValue);
1727    }
1728    textBuilder(parent = null) {
1729        this.observeComponentCreation2((elmtId, isInitialRender) => {
1730            Column.create();
1731        }, Column);
1732        this.observeComponentCreation2((elmtId, isInitialRender) => {
1733            Scroll.create(this.contentScroller);
1734            Scroll.fadingEdge(IS_FADEOUT_ENABLE(), { fadingEdgeLength: LengthMetrics.vp(FADEOUT_GRADIENT_WIDTH) });
1735            Scroll.nestedScroll({
1736                scrollForward: NestedScrollMode.PARALLEL,
1737                scrollBackward: NestedScrollMode.PARALLEL
1738            });
1739            Scroll.margin({ end: LengthMetrics.vp(0 - SCROLL_BAR_OFFSET) });
1740        }, Scroll);
1741        this.observeComponentCreation2((elmtId, isInitialRender) => {
1742            Column.create();
1743            Column.margin({ end: LengthMetrics.vp(SCROLL_BAR_OFFSET) });
1744            Column.width(`calc(100% - ${SCROLL_BAR_OFFSET}vp)`);
1745        }, Column);
1746        this.observeComponentCreation2((elmtId, isInitialRender) => {
1747            Text.create(this.content);
1748            Text.focusable(true);
1749            Text.defaultFocus(!(this.primaryButton?.value || this.secondaryButton?.value));
1750            Text.focusBox({
1751                strokeWidth: LengthMetrics.px(0)
1752            });
1753            Text.fontSize(`${CONTENT_FONT_SIZE()}fp`);
1754            Text.fontWeight(CONTENT_FONT_WEIGHT());
1755            Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
1756            Text.textAlign(this.textAlign);
1757            Text.onKeyEvent((event) => {
1758                if (event) {
1759                    resolveKeyEvent(event, this.contentScroller);
1760                }
1761            });
1762            Text.width('100%');
1763        }, Text);
1764        Text.pop();
1765        Column.pop();
1766        Scroll.pop();
1767        Column.pop();
1768    }
1769    checkBoxBuilder(parent = null) {
1770        this.observeComponentCreation2((elmtId, isInitialRender) => {
1771            Row.create();
1772            Row.accessibilityGroup(true);
1773            Row.accessibilityText(getCheckTipsAccessibilityText(this.checkTips, this.isChecked));
1774            Row.accessibilityDescription(this.isChecked ? {
1775                'id': -1,
1776                'type': 10003,
1777                params: ['sys.string.advanced_dialog_accessibility_cancel_checked_desc'],
1778                'bundleName': '__harDefaultBundleName__',
1779                'moduleName': '__harDefaultModuleName__'
1780            } : {
1781                'id': -1,
1782                'type': 10003,
1783                params: ['sys.string.slider_accessibility_unselectedDesc'],
1784                'bundleName': '__harDefaultBundleName__',
1785                'moduleName': '__harDefaultModuleName__'
1786            });
1787            Row.onClick(() => {
1788                this.isChecked = !this.isChecked;
1789                try {
1790                    let eventInfo = ({
1791                        type: 'announceForAccessibility',
1792                        bundleName: getContext()?.abilityInfo?.bundleName,
1793                        triggerAction: 'common',
1794                        textAnnouncedForAccessibility: this.isChecked ?
1795                        getContext().resourceManager.getStringSync(125833934) :
1796                        getContext().resourceManager.getStringSync(125833935)
1797                    });
1798                    accessibility.sendAccessibilityEvent(eventInfo).then(() => {
1799                    });
1800                } catch (exception) {
1801                    let code = exception.code;
1802                    let message = exception.message;
1803                    hilog.error(0x3900, 'Ace', `Faild to send event, cause, code: ${code}, message: ${message}`);
1804                }
1805            });
1806            Row.width('100%');
1807            Row.padding({ top: TIP_CHECKBOX_TOP_PADDING(), bottom: TIP_CHECKBOX_BOTTOM_PADDING() });
1808        }, Row);
1809        this.observeComponentCreation2((elmtId, isInitialRender) => {
1810            Checkbox.create({ name: '', group: 'checkboxGroup' });
1811            Checkbox.select(this.isChecked);
1812            Checkbox.onChange((checked) => {
1813                this.isChecked = checked;
1814                if (this.onCheckedChange) {
1815                    this.onCheckedChange(this.isChecked);
1816                }
1817            });
1818            Checkbox.hitTestBehavior(HitTestMode.Block);
1819            Checkbox.margin({ start: LengthMetrics.vp(0), end: LengthMetrics.vp(TIP_CHECKBOX_END_MARGIN()) });
1820        }, Checkbox);
1821        Checkbox.pop();
1822        this.observeComponentCreation2((elmtId, isInitialRender) => {
1823            Text.create(this.checkTips);
1824            Text.fontSize(`${SUBTITLE_SIZE()}fp`);
1825            Text.fontWeight(CONTENT_FONT_WEIGHT());
1826            Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
1827            Text.maxLines(CONTENT_MAX_LINES);
1828            Text.focusable(false);
1829            Text.layoutWeight(1);
1830            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
1831        }, Text);
1832        Text.pop();
1833        Row.pop();
1834    }
1835    buildContent(parent = null) {
1836        {
1837            this.observeComponentCreation2((elmtId, isInitialRender) => {
1838                if (isInitialRender) {
1839                    let componentCall = new ConfirmDialogContentLayout(this, {
1840                        minContentHeight: this.__minContentHeight,
1841                        dialogBuilder: () => {
1842                            this.observeComponentCreation2((elmtId, isInitialRender) => {
1843                                ForEach.create();
1844                                const forEachItemGenFunction = _item => {
1845                                    const index = _item;
1846                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1847                                        If.create();
1848                                        if (index === this.textIndex) {
1849                                            this.ifElseBranchUpdateFunction(0, () => {
1850                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
1851                                                    WithTheme.create({
1852                                                        theme: this.theme,
1853                                                        colorMode: this.themeColorMode
1854                                                    });
1855                                                }, WithTheme);
1856                                                this.textBuilder.bind(this)();
1857                                                WithTheme.pop();
1858                                            });
1859                                        } else if (index === this.checkboxIndex) {
1860                                            this.ifElseBranchUpdateFunction(1, () => {
1861                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
1862                                                    WithTheme.create({
1863                                                        theme: this.theme,
1864                                                        colorMode: this.themeColorMode
1865                                                    });
1866                                                }, WithTheme);
1867                                                this.checkBoxBuilder.bind(this)();
1868                                                WithTheme.pop();
1869                                            });
1870                                        } else {
1871                                            this.ifElseBranchUpdateFunction(2, () => {
1872                                            });
1873                                        }
1874                                    }, If);
1875                                    If.pop();
1876                                };
1877                                this.forEachUpdateFunction(elmtId,
1878                                    [this.textIndex, this.checkboxIndex], forEachItemGenFunction);
1879                            }, ForEach);
1880                            ForEach.pop();
1881                        }
1882                    }, undefined, elmtId, () => {
1883                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 807, col: 5 });
1884                    ViewPU.create(componentCall);
1885                    let paramsLambda = () => {
1886                        return {
1887                            minContentHeight: this.minContentHeight,
1888                            dialogBuilder: () => {
1889                                this.observeComponentCreation2((elmtId, isInitialRender) => {
1890                                    ForEach.create();
1891                                    const forEachItemGenFunction = _item => {
1892                                        const index = _item;
1893                                        this.observeComponentCreation2((elmtId, isInitialRender) => {
1894                                            If.create();
1895                                            if (index === this.textIndex) {
1896                                                this.ifElseBranchUpdateFunction(0, () => {
1897                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1898                                                        WithTheme.create({
1899                                                            theme: this.theme,
1900                                                            colorMode: this.themeColorMode
1901                                                        });
1902                                                    }, WithTheme);
1903                                                    this.textBuilder.bind(this)();
1904                                                    WithTheme.pop();
1905                                                });
1906                                            } else if (index === this.checkboxIndex) {
1907                                                this.ifElseBranchUpdateFunction(1, () => {
1908                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
1909                                                        WithTheme.create({
1910                                                            theme: this.theme,
1911                                                            colorMode: this.themeColorMode
1912                                                        });
1913                                                    }, WithTheme);
1914                                                    this.checkBoxBuilder.bind(this)();
1915                                                    WithTheme.pop();
1916                                                });
1917                                            } else {
1918                                                this.ifElseBranchUpdateFunction(2, () => {
1919                                                });
1920                                            }
1921                                        }, If);
1922                                        If.pop();
1923                                    };
1924                                    this.forEachUpdateFunction(elmtId,
1925                                        [this.textIndex, this.checkboxIndex], forEachItemGenFunction);
1926                                }, ForEach);
1927                                ForEach.pop();
1928                            }
1929                        };
1930                    };
1931                    componentCall.paramsGenerator_ = paramsLambda;
1932                } else {
1933                    this.updateStateVarsOfChildByElmtId(elmtId, {});
1934                }
1935            }, { name: 'ConfirmDialogContentLayout' });
1936        }
1937    }
1938    initialRender() {
1939        this.observeComponentCreation2((elmtId, isInitialRender) => {
1940            __Common__.create();
1941            __Common__.constraintSize({ maxHeight: '100%' });
1942        }, __Common__);
1943        {
1944            this.observeComponentCreation2((elmtId, isInitialRender) => {
1945                if (isInitialRender) {
1946                    let componentCall = new CustomDialogContentComponent(this, {
1947                        primaryTitle: this.title,
1948                        controller: this.controller,
1949                        contentBuilder: () => {
1950                            this.buildContent();
1951                        },
1952                        minContentHeight: this.__minContentHeight,
1953                        buttons: this.buttons,
1954                        theme: this.theme,
1955                        themeColorMode: this.themeColorMode,
1956                        fontSizeScale: this.__fontSizeScale,
1957                    }, undefined, elmtId, () => {
1958                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 823, col: 5 });
1959                    ViewPU.create(componentCall);
1960                    let paramsLambda = () => {
1961                        return {
1962                            primaryTitle: this.title,
1963                            controller: this.controller,
1964                            contentBuilder: () => {
1965                                this.buildContent();
1966                            },
1967                            minContentHeight: this.minContentHeight,
1968                            buttons: this.buttons,
1969                            theme: this.theme,
1970                            themeColorMode: this.themeColorMode,
1971                            fontSizeScale: this.fontSizeScale
1972                        };
1973                    };
1974                    componentCall.paramsGenerator_ = paramsLambda;
1975                } else {
1976                    this.updateStateVarsOfChildByElmtId(elmtId, {});
1977                }
1978            }, { name: 'CustomDialogContentComponent' });
1979        }
1980        __Common__.pop();
1981    }
1982    aboutToAppear() {
1983        this.fontColorWithTheme = this.theme?.colors?.fontPrimary ?
1984        this.theme.colors.fontPrimary : {
1985                'id': -1,
1986                'type': 10001,
1987                params: ['sys.color.font_primary'],
1988                'bundleName': '__harDefaultBundleName__',
1989                'moduleName': '__harDefaultModuleName__'
1990            };
1991        this.initButtons();
1992        this.initMargin();
1993    }
1994    initMargin() {
1995        this.marginOffset = 0 - SCROLL_END_MARGIN();
1996    }
1997    initButtons() {
1998        if (!this.primaryButton && !this.secondaryButton) {
1999            return;
2000        }
2001        this.buttons = [];
2002        if (this.primaryButton) {
2003            this.buttons.push(this.primaryButton);
2004        }
2005        if (this.secondaryButton) {
2006            this.buttons.push(this.secondaryButton);
2007        }
2008    }
2009    rerender() {
2010        this.updateDirtyElements();
2011    }
2012}
2013export class AlertDialog extends ViewPU {
2014    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
2015        super(parent, __localStorage, elmtId, extraInfo);
2016        if (typeof paramsLambda === 'function') {
2017            this.paramsGenerator_ = paramsLambda;
2018        }
2019        this.controller = undefined;
2020        this.primaryTitle = undefined;
2021        this.secondaryTitle = undefined;
2022        this.content = '';
2023        this.primaryButton = null;
2024        this.secondaryButton = null;
2025        this.buttons = undefined;
2026        this.__textAlign = new ObservedPropertySimplePU(TextAlign.Center, this, 'textAlign');
2027        this.contentScroller = new Scroller();
2028        this.__fontColorWithTheme = new ObservedPropertyObjectPU({
2029            'id': -1,
2030            'type': 10001,
2031            params: ['sys.color.font_primary'],
2032            'bundleName': '__harDefaultBundleName__',
2033            'moduleName': '__harDefaultModuleName__'
2034        }, this, 'fontColorWithTheme');
2035        this.theme = new CustomThemeImpl({});
2036        this.themeColorMode = ThemeColorMode.SYSTEM;
2037        this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale');
2038        this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight');
2039        this.setInitiallyProvidedValue(params);
2040        this.finalizeConstruction();
2041    }
2042    setInitiallyProvidedValue(params) {
2043        if (params.controller !== undefined) {
2044            this.controller = params.controller;
2045        }
2046        if (params.primaryTitle !== undefined) {
2047            this.primaryTitle = params.primaryTitle;
2048        }
2049        if (params.secondaryTitle !== undefined) {
2050            this.secondaryTitle = params.secondaryTitle;
2051        }
2052        if (params.content !== undefined) {
2053            this.content = params.content;
2054        }
2055        if (params.primaryButton !== undefined) {
2056            this.primaryButton = params.primaryButton;
2057        }
2058        if (params.secondaryButton !== undefined) {
2059            this.secondaryButton = params.secondaryButton;
2060        }
2061        if (params.buttons !== undefined) {
2062            this.buttons = params.buttons;
2063        }
2064        if (params.textAlign !== undefined) {
2065            this.textAlign = params.textAlign;
2066        }
2067        if (params.contentScroller !== undefined) {
2068            this.contentScroller = params.contentScroller;
2069        }
2070        if (params.fontColorWithTheme !== undefined) {
2071            this.fontColorWithTheme = params.fontColorWithTheme;
2072        }
2073        if (params.theme !== undefined) {
2074            this.theme = params.theme;
2075        }
2076        if (params.themeColorMode !== undefined) {
2077            this.themeColorMode = params.themeColorMode;
2078        }
2079        if (params.fontSizeScale !== undefined) {
2080            this.fontSizeScale = params.fontSizeScale;
2081        }
2082        if (params.minContentHeight !== undefined) {
2083            this.minContentHeight = params.minContentHeight;
2084        }
2085    }
2086    updateStateVars(params) {
2087    }
2088    purgeVariableDependenciesOnElmtId(rmElmtId) {
2089        this.__textAlign.purgeDependencyOnElmtId(rmElmtId);
2090        this.__fontColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
2091        this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId);
2092        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
2093    }
2094    aboutToBeDeleted() {
2095        this.__textAlign.aboutToBeDeleted();
2096        this.__fontColorWithTheme.aboutToBeDeleted();
2097        this.__fontSizeScale.aboutToBeDeleted();
2098        this.__minContentHeight.aboutToBeDeleted();
2099        SubscriberManager.Get().delete(this.id__());
2100        this.aboutToBeDeletedInternal();
2101    }
2102    setController(ctr) {
2103        this.controller = ctr;
2104    }
2105    get textAlign() {
2106        return this.__textAlign.get();
2107    }
2108    set textAlign(newValue) {
2109        this.__textAlign.set(newValue);
2110    }
2111    get fontColorWithTheme() {
2112        return this.__fontColorWithTheme.get();
2113    }
2114    set fontColorWithTheme(newValue) {
2115        this.__fontColorWithTheme.set(newValue);
2116    }
2117    get fontSizeScale() {
2118        return this.__fontSizeScale.get();
2119    }
2120    set fontSizeScale(newValue) {
2121        this.__fontSizeScale.set(newValue);
2122    }
2123    get minContentHeight() {
2124        return this.__minContentHeight.get();
2125    }
2126    set minContentHeight(newValue) {
2127        this.__minContentHeight.set(newValue);
2128    }
2129    initialRender() {
2130        this.observeComponentCreation2((elmtId, isInitialRender) => {
2131            __Common__.create();
2132            __Common__.constraintSize({ maxHeight: '100%' });
2133        }, __Common__);
2134        {
2135            this.observeComponentCreation2((elmtId, isInitialRender) => {
2136                if (isInitialRender) {
2137                    let componentCall = new CustomDialogContentComponent(this, {
2138                        primaryTitle: this.primaryTitle,
2139                        secondaryTitle: this.secondaryTitle,
2140                        controller: this.controller,
2141                        contentBuilder: () => {
2142                            this.AlertDialogContentBuilder();
2143                        },
2144                        buttons: this.buttons,
2145                        theme: this.theme,
2146                        themeColorMode: this.themeColorMode,
2147                        fontSizeScale: this.__fontSizeScale,
2148                        minContentHeight: this.__minContentHeight,
2149                    }, undefined, elmtId, () => {
2150                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 881, col: 5 });
2151                    ViewPU.create(componentCall);
2152                    let paramsLambda = () => {
2153                        return {
2154                            primaryTitle: this.primaryTitle,
2155                            secondaryTitle: this.secondaryTitle,
2156                            controller: this.controller,
2157                            contentBuilder: () => {
2158                                this.AlertDialogContentBuilder();
2159                            },
2160                            buttons: this.buttons,
2161                            theme: this.theme,
2162                            themeColorMode: this.themeColorMode,
2163                            fontSizeScale: this.fontSizeScale,
2164                            minContentHeight: this.minContentHeight
2165                        };
2166                    };
2167                    componentCall.paramsGenerator_ = paramsLambda;
2168                } else {
2169                    this.updateStateVarsOfChildByElmtId(elmtId, {});
2170                }
2171            }, { name: 'CustomDialogContentComponent' });
2172        }
2173        __Common__.pop();
2174    }
2175    AlertDialogContentBuilder(parent = null) {
2176        this.observeComponentCreation2((elmtId, isInitialRender) => {
2177            Column.create();
2178            Column.margin({ end: LengthMetrics.vp(0 - SCROLL_BAR_OFFSET) });
2179        }, Column);
2180        this.observeComponentCreation2((elmtId, isInitialRender) => {
2181            Scroll.create(this.contentScroller);
2182            Scroll.fadingEdge(IS_FADEOUT_ENABLE(), { fadingEdgeLength: LengthMetrics.vp(FADEOUT_GRADIENT_WIDTH) });
2183            Scroll.nestedScroll({
2184                scrollForward: NestedScrollMode.PARALLEL,
2185                scrollBackward: NestedScrollMode.PARALLEL
2186            });
2187            Scroll.width('100%');
2188        }, Scroll);
2189        this.observeComponentCreation2((elmtId, isInitialRender) => {
2190            Text.create(this.content);
2191            Text.focusable(true);
2192            Text.defaultFocus(!(this.primaryButton || this.secondaryButton));
2193            Text.focusBox({
2194                strokeWidth: LengthMetrics.px(0)
2195            });
2196            Text.fontSize(`${CONTENT_FONT_SIZE()}fp`);
2197            Text.fontWeight(this.getFontWeight());
2198            Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
2199            Text.margin({ end: LengthMetrics.vp(SCROLL_BAR_OFFSET) });
2200            Text.width(`calc(100% - ${SCROLL_BAR_OFFSET}vp)`);
2201            Text.textAlign(this.textAlign);
2202            Text.onKeyEvent((event) => {
2203                if (event) {
2204                    resolveKeyEvent(event, this.contentScroller);
2205                }
2206            });
2207        }, Text);
2208        Text.pop();
2209        Scroll.pop();
2210        Column.pop();
2211    }
2212    aboutToAppear() {
2213        this.fontColorWithTheme = this.theme?.colors?.fontPrimary ?
2214        this.theme.colors.fontPrimary : {
2215                'id': -1,
2216                'type': 10001,
2217                params: ['sys.color.font_primary'],
2218                'bundleName': '__harDefaultBundleName__',
2219                'moduleName': '__harDefaultModuleName__'
2220            };
2221        this.initButtons();
2222    }
2223    initButtons() {
2224        if (!this.primaryButton && !this.secondaryButton) {
2225            return;
2226        }
2227        this.buttons = [];
2228        if (this.primaryButton) {
2229            this.buttons.push(this.primaryButton);
2230        }
2231        if (this.secondaryButton) {
2232            this.buttons.push(this.secondaryButton);
2233        }
2234    }
2235    getFontWeight() {
2236        if (this.primaryTitle || this.secondaryTitle) {
2237            return FontWeight.Regular;
2238        }
2239        return CONTENT_FONT_WEIGHT();
2240    }
2241    rerender() {
2242        this.updateDirtyElements();
2243    }
2244}
2245export class CustomContentDialog extends ViewPU {
2246    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
2247        super(parent, __localStorage, elmtId, extraInfo);
2248        if (typeof paramsLambda === 'function') {
2249            this.paramsGenerator_ = paramsLambda;
2250        }
2251        this.controller = undefined;
2252        this.primaryTitle = undefined;
2253        this.secondaryTitle = undefined;
2254        this.contentBuilder = undefined;
2255        this.contentAreaPadding = undefined;
2256        this.localizedContentAreaPadding = undefined;
2257        this.buttons = undefined;
2258        this.theme = new CustomThemeImpl({});
2259        this.themeColorMode = ThemeColorMode.SYSTEM;
2260        this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale');
2261        this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight');
2262        this.setInitiallyProvidedValue(params);
2263        this.finalizeConstruction();
2264    }
2265    setInitiallyProvidedValue(params) {
2266        if (params.controller !== undefined) {
2267            this.controller = params.controller;
2268        }
2269        if (params.primaryTitle !== undefined) {
2270            this.primaryTitle = params.primaryTitle;
2271        }
2272        if (params.secondaryTitle !== undefined) {
2273            this.secondaryTitle = params.secondaryTitle;
2274        }
2275        if (params.contentBuilder !== undefined) {
2276            this.contentBuilder = params.contentBuilder;
2277        }
2278        if (params.contentAreaPadding !== undefined) {
2279            this.contentAreaPadding = params.contentAreaPadding;
2280        }
2281        if (params.localizedContentAreaPadding !== undefined) {
2282            this.localizedContentAreaPadding = params.localizedContentAreaPadding;
2283        }
2284        if (params.buttons !== undefined) {
2285            this.buttons = params.buttons;
2286        }
2287        if (params.theme !== undefined) {
2288            this.theme = params.theme;
2289        }
2290        if (params.themeColorMode !== undefined) {
2291            this.themeColorMode = params.themeColorMode;
2292        }
2293        if (params.fontSizeScale !== undefined) {
2294            this.fontSizeScale = params.fontSizeScale;
2295        }
2296        if (params.minContentHeight !== undefined) {
2297            this.minContentHeight = params.minContentHeight;
2298        }
2299    }
2300    updateStateVars(params) {
2301    }
2302    purgeVariableDependenciesOnElmtId(rmElmtId) {
2303        this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId);
2304        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
2305    }
2306    aboutToBeDeleted() {
2307        this.__fontSizeScale.aboutToBeDeleted();
2308        this.__minContentHeight.aboutToBeDeleted();
2309        SubscriberManager.Get().delete(this.id__());
2310        this.aboutToBeDeletedInternal();
2311    }
2312    setController(ctr) {
2313        this.controller = ctr;
2314    }
2315    get fontSizeScale() {
2316        return this.__fontSizeScale.get();
2317    }
2318    set fontSizeScale(newValue) {
2319        this.__fontSizeScale.set(newValue);
2320    }
2321    get minContentHeight() {
2322        return this.__minContentHeight.get();
2323    }
2324    set minContentHeight(newValue) {
2325        this.__minContentHeight.set(newValue);
2326    }
2327    initialRender() {
2328        this.observeComponentCreation2((elmtId, isInitialRender) => {
2329            __Common__.create();
2330            __Common__.constraintSize({ maxHeight: '100%' });
2331        }, __Common__);
2332        {
2333            this.observeComponentCreation2((elmtId, isInitialRender) => {
2334                if (isInitialRender) {
2335                    let componentCall = new CustomDialogContentComponent(this, {
2336                        controller: this.controller,
2337                        primaryTitle: this.primaryTitle,
2338                        secondaryTitle: this.secondaryTitle,
2339                        contentBuilder: () => {
2340                            this.contentBuilder();
2341                        },
2342                        contentAreaPadding: this.contentAreaPadding,
2343                        localizedContentAreaPadding: this.localizedContentAreaPadding,
2344                        buttons: this.buttons,
2345                        theme: this.theme,
2346                        themeColorMode: this.themeColorMode,
2347                        fontSizeScale: this.__fontSizeScale,
2348                        minContentHeight: this.__minContentHeight,
2349                        customStyle: false
2350                    }, undefined, elmtId, () => {
2351                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 967, col: 5 });
2352                    ViewPU.create(componentCall);
2353                    let paramsLambda = () => {
2354                        return {
2355                            controller: this.controller,
2356                            primaryTitle: this.primaryTitle,
2357                            secondaryTitle: this.secondaryTitle,
2358                            contentBuilder: () => {
2359                                this.contentBuilder();
2360                            },
2361                            contentAreaPadding: this.contentAreaPadding,
2362                            localizedContentAreaPadding: this.localizedContentAreaPadding,
2363                            buttons: this.buttons,
2364                            theme: this.theme,
2365                            themeColorMode: this.themeColorMode,
2366                            fontSizeScale: this.fontSizeScale,
2367                            minContentHeight: this.minContentHeight,
2368                            customStyle: false
2369                        };
2370                    };
2371                    componentCall.paramsGenerator_ = paramsLambda;
2372                } else {
2373                    this.updateStateVarsOfChildByElmtId(elmtId, {});
2374                }
2375            }, { name: 'CustomDialogContentComponent' });
2376        }
2377        __Common__.pop();
2378    }
2379    rerender() {
2380        this.updateDirtyElements();
2381    }
2382}
2383class CustomDialogControllerExtend extends CustomDialogController {
2384    constructor(value) {
2385        super(value);
2386        this.arg_ = value;
2387    }
2388}
2389class CustomDialogLayout extends ViewPU {
2390    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
2391        super(parent, __localStorage, elmtId, extraInfo);
2392        if (typeof paramsLambda === 'function') {
2393            this.paramsGenerator_ = paramsLambda;
2394        }
2395        this.__titleHeight = new SynchedPropertySimpleTwoWayPU(params.titleHeight, this, 'titleHeight');
2396        this.__buttonHeight = new SynchedPropertySimpleTwoWayPU(params.buttonHeight, this, 'buttonHeight');
2397        this.__titleMinHeight = new SynchedPropertyObjectTwoWayPU(params.titleMinHeight, this, 'titleMinHeight');
2398        this.dialogBuilder = this.doNothingBuilder;
2399        this.titleIndex = 0;
2400        this.contentIndex = 1;
2401        this.buttonIndex = 2;
2402        this.setInitiallyProvidedValue(params);
2403        this.finalizeConstruction();
2404    }
2405    setInitiallyProvidedValue(params) {
2406        if (params.dialogBuilder !== undefined) {
2407            this.dialogBuilder = params.dialogBuilder;
2408        }
2409        if (params.titleIndex !== undefined) {
2410            this.titleIndex = params.titleIndex;
2411        }
2412        if (params.contentIndex !== undefined) {
2413            this.contentIndex = params.contentIndex;
2414        }
2415        if (params.buttonIndex !== undefined) {
2416            this.buttonIndex = params.buttonIndex;
2417        }
2418    }
2419    updateStateVars(params) {
2420    }
2421    purgeVariableDependenciesOnElmtId(rmElmtId) {
2422        this.__titleHeight.purgeDependencyOnElmtId(rmElmtId);
2423        this.__buttonHeight.purgeDependencyOnElmtId(rmElmtId);
2424        this.__titleMinHeight.purgeDependencyOnElmtId(rmElmtId);
2425    }
2426    aboutToBeDeleted() {
2427        this.__titleHeight.aboutToBeDeleted();
2428        this.__buttonHeight.aboutToBeDeleted();
2429        this.__titleMinHeight.aboutToBeDeleted();
2430        SubscriberManager.Get().delete(this.id__());
2431        this.aboutToBeDeletedInternal();
2432    }
2433    doNothingBuilder(parent = null) {
2434    }
2435    get titleHeight() {
2436        return this.__titleHeight.get();
2437    }
2438    set titleHeight(newValue) {
2439        this.__titleHeight.set(newValue);
2440    }
2441    get buttonHeight() {
2442        return this.__buttonHeight.get();
2443    }
2444    set buttonHeight(newValue) {
2445        this.__buttonHeight.set(newValue);
2446    }
2447    get titleMinHeight() {
2448        return this.__titleMinHeight.get();
2449    }
2450    set titleMinHeight(newValue) {
2451        this.__titleMinHeight.set(newValue);
2452    }
2453    onPlaceChildren(selfLayoutInfo, children, constraint) {
2454        let currentX = 0;
2455        let currentY = 0;
2456        for (let index = 0; index < children.length; index++) {
2457            let child = children[index];
2458            child.layout({ x: currentX, y: currentY });
2459            currentY += child.measureResult.height;
2460        }
2461    }
2462    onMeasureSize(selfLayoutInfo, children, constraint) {
2463        let sizeResult = { width: Number(constraint.maxWidth), height: 0 };
2464        let childrenSize = 3;
2465        if (children.length < childrenSize) {
2466            return sizeResult;
2467        }
2468        let height = 0;
2469        let titleChild = children[this.titleIndex];
2470        let titleConstraint = {
2471            maxWidth: constraint.maxWidth,
2472            minHeight: this.titleMinHeight,
2473            maxHeight: constraint.maxHeight
2474        };
2475        let titleMeasureResult = titleChild.measure(titleConstraint);
2476        this.titleHeight = titleMeasureResult.height;
2477        height += this.titleHeight;
2478        let buttonChild = children[this.buttonIndex];
2479        let buttonMeasureResult = buttonChild.measure(constraint);
2480        this.buttonHeight = buttonMeasureResult.height;
2481        height += this.buttonHeight;
2482        let contentChild = children[this.contentIndex];
2483        let contentConstraint = {
2484            maxWidth: constraint.maxWidth,
2485            maxHeight: Number(constraint.maxHeight) - height
2486        };
2487        let contentMeasureResult = contentChild.measure(contentConstraint);
2488        height += contentMeasureResult.height;
2489        sizeResult.height = height;
2490        return sizeResult;
2491    }
2492    initialRender() {
2493        this.dialogBuilder.bind(this)();
2494    }
2495    rerender() {
2496        this.updateDirtyElements();
2497    }
2498}
2499class CustomDialogContentComponent extends ViewPU {
2500    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
2501        super(parent, __localStorage, elmtId, extraInfo);
2502        if (typeof paramsLambda === 'function') {
2503            this.paramsGenerator_ = paramsLambda;
2504        }
2505        this.controller = undefined;
2506        this.primaryTitle = undefined;
2507        this.secondaryTitle = undefined;
2508        this.localizedContentAreaPadding = undefined;
2509        this.contentBuilder = this.defaultContentBuilder;
2510        this.buttons = undefined;
2511        this.contentAreaPadding = undefined;
2512        this.keyIndex = 0;
2513        this.theme = new CustomThemeImpl({});
2514        this.themeColorMode = ThemeColorMode.SYSTEM;
2515        this.__minContentHeight = new SynchedPropertySimpleTwoWayPU(params.minContentHeight, this, 'minContentHeight');
2516        this.__titleHeight = new ObservedPropertySimplePU(0, this, 'titleHeight');
2517        this.__buttonHeight = new ObservedPropertySimplePU(0, this, 'buttonHeight');
2518        this.__contentMaxHeight = new ObservedPropertyObjectPU('100%', this, 'contentMaxHeight');
2519        this.__fontSizeScale = new SynchedPropertySimpleTwoWayPU(params.fontSizeScale, this, 'fontSizeScale');
2520        this.__customStyle = new ObservedPropertySimplePU(undefined, this, 'customStyle');
2521        this.__buttonMaxFontSize = new ObservedPropertyObjectPU(`${BODY_L}fp`, this, 'buttonMaxFontSize');
2522        this.__buttonMinFontSize = new ObservedPropertyObjectPU(9, this, 'buttonMinFontSize');
2523        this.__primaryTitleFontSize = new ObservedPropertyObjectPU(`${TITLE_S}fp`, this, 'primaryTitleFontSize');
2524        this.__secondaryTitleFontSize = new ObservedPropertyObjectPU(`${SUBTITLE_SIZE()}fp`, this, 'secondaryTitleFontSize');
2525        this.__primaryTitleFontColorWithTheme = new ObservedPropertyObjectPU({
2526            'id': -1,
2527            'type': 10001,
2528            params: ['sys.color.font_primary'],
2529            'bundleName': '__harDefaultBundleName__',
2530            'moduleName': '__harDefaultModuleName__'
2531        }, this, 'primaryTitleFontColorWithTheme');
2532        this.__secondaryTitleFontColorWithTheme = new ObservedPropertyObjectPU({
2533            'id': -1,
2534            'type': 10001,
2535            params: ['sys.color.font_secondary'],
2536            'bundleName': '__harDefaultBundleName__',
2537            'moduleName': '__harDefaultModuleName__'
2538        }, this, 'secondaryTitleFontColorWithTheme');
2539        this.__titleTextAlign = new ObservedPropertySimplePU(TextAlign.Center, this, 'titleTextAlign');
2540        this.__isButtonVertical = new ObservedPropertySimplePU(false, this, 'isButtonVertical');
2541        this.__titleMinHeight = new ObservedPropertyObjectPU(0, this, 'titleMinHeight');
2542        this.isFollowingSystemFontScale = false;
2543        this.appMaxFontScale = 3.2;
2544        this.titleIndex = 0;
2545        this.contentIndex = 1;
2546        this.buttonIndex = 2;
2547        this.isHasDefaultFocus = false;
2548        this.isAllFocusFalse = false;
2549        this.scroller = new Scroller();
2550        this.setInitiallyProvidedValue(params);
2551        this.finalizeConstruction();
2552    }
2553    setInitiallyProvidedValue(params) {
2554        if (params.controller !== undefined) {
2555            this.controller = params.controller;
2556        }
2557        if (params.primaryTitle !== undefined) {
2558            this.primaryTitle = params.primaryTitle;
2559        }
2560        if (params.secondaryTitle !== undefined) {
2561            this.secondaryTitle = params.secondaryTitle;
2562        }
2563        if (params.localizedContentAreaPadding !== undefined) {
2564            this.localizedContentAreaPadding = params.localizedContentAreaPadding;
2565        }
2566        if (params.contentBuilder !== undefined) {
2567            this.contentBuilder = params.contentBuilder;
2568        }
2569        if (params.buttons !== undefined) {
2570            this.buttons = params.buttons;
2571        }
2572        if (params.contentAreaPadding !== undefined) {
2573            this.contentAreaPadding = params.contentAreaPadding;
2574        }
2575        if (params.keyIndex !== undefined) {
2576            this.keyIndex = params.keyIndex;
2577        }
2578        if (params.theme !== undefined) {
2579            this.theme = params.theme;
2580        }
2581        if (params.themeColorMode !== undefined) {
2582            this.themeColorMode = params.themeColorMode;
2583        }
2584        if (params.titleHeight !== undefined) {
2585            this.titleHeight = params.titleHeight;
2586        }
2587        if (params.buttonHeight !== undefined) {
2588            this.buttonHeight = params.buttonHeight;
2589        }
2590        if (params.contentMaxHeight !== undefined) {
2591            this.contentMaxHeight = params.contentMaxHeight;
2592        }
2593        if (params.customStyle !== undefined) {
2594            this.customStyle = params.customStyle;
2595        }
2596        if (params.buttonMaxFontSize !== undefined) {
2597            this.buttonMaxFontSize = params.buttonMaxFontSize;
2598        }
2599        if (params.buttonMinFontSize !== undefined) {
2600            this.buttonMinFontSize = params.buttonMinFontSize;
2601        }
2602        if (params.primaryTitleFontSize !== undefined) {
2603            this.primaryTitleFontSize = params.primaryTitleFontSize;
2604        }
2605        if (params.secondaryTitleFontSize !== undefined) {
2606            this.secondaryTitleFontSize = params.secondaryTitleFontSize;
2607        }
2608        if (params.primaryTitleFontColorWithTheme !== undefined) {
2609            this.primaryTitleFontColorWithTheme = params.primaryTitleFontColorWithTheme;
2610        }
2611        if (params.secondaryTitleFontColorWithTheme !== undefined) {
2612            this.secondaryTitleFontColorWithTheme = params.secondaryTitleFontColorWithTheme;
2613        }
2614        if (params.titleTextAlign !== undefined) {
2615            this.titleTextAlign = params.titleTextAlign;
2616        }
2617        if (params.isButtonVertical !== undefined) {
2618            this.isButtonVertical = params.isButtonVertical;
2619        }
2620        if (params.titleMinHeight !== undefined) {
2621            this.titleMinHeight = params.titleMinHeight;
2622        }
2623        if (params.isFollowingSystemFontScale !== undefined) {
2624            this.isFollowingSystemFontScale = params.isFollowingSystemFontScale;
2625        }
2626        if (params.appMaxFontScale !== undefined) {
2627            this.appMaxFontScale = params.appMaxFontScale;
2628        }
2629        if (params.titleIndex !== undefined) {
2630            this.titleIndex = params.titleIndex;
2631        }
2632        if (params.contentIndex !== undefined) {
2633            this.contentIndex = params.contentIndex;
2634        }
2635        if (params.buttonIndex !== undefined) {
2636            this.buttonIndex = params.buttonIndex;
2637        }
2638        if (params.isHasDefaultFocus !== undefined) {
2639            this.isHasDefaultFocus = params.isHasDefaultFocus;
2640        }
2641        if (params.isAllFocusFalse !== undefined) {
2642            this.isAllFocusFalse = params.isAllFocusFalse;
2643        }
2644        if (params.scroller !== undefined) {
2645            this.scroller = params.scroller;
2646        }
2647    }
2648    updateStateVars(params) {
2649    }
2650    purgeVariableDependenciesOnElmtId(rmElmtId) {
2651        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
2652        this.__titleHeight.purgeDependencyOnElmtId(rmElmtId);
2653        this.__buttonHeight.purgeDependencyOnElmtId(rmElmtId);
2654        this.__contentMaxHeight.purgeDependencyOnElmtId(rmElmtId);
2655        this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId);
2656        this.__customStyle.purgeDependencyOnElmtId(rmElmtId);
2657        this.__buttonMaxFontSize.purgeDependencyOnElmtId(rmElmtId);
2658        this.__buttonMinFontSize.purgeDependencyOnElmtId(rmElmtId);
2659        this.__primaryTitleFontSize.purgeDependencyOnElmtId(rmElmtId);
2660        this.__secondaryTitleFontSize.purgeDependencyOnElmtId(rmElmtId);
2661        this.__primaryTitleFontColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
2662        this.__secondaryTitleFontColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
2663        this.__titleTextAlign.purgeDependencyOnElmtId(rmElmtId);
2664        this.__isButtonVertical.purgeDependencyOnElmtId(rmElmtId);
2665        this.__titleMinHeight.purgeDependencyOnElmtId(rmElmtId);
2666    }
2667    aboutToBeDeleted() {
2668        this.__minContentHeight.aboutToBeDeleted();
2669        this.__titleHeight.aboutToBeDeleted();
2670        this.__buttonHeight.aboutToBeDeleted();
2671        this.__contentMaxHeight.aboutToBeDeleted();
2672        this.__fontSizeScale.aboutToBeDeleted();
2673        this.__customStyle.aboutToBeDeleted();
2674        this.__buttonMaxFontSize.aboutToBeDeleted();
2675        this.__buttonMinFontSize.aboutToBeDeleted();
2676        this.__primaryTitleFontSize.aboutToBeDeleted();
2677        this.__secondaryTitleFontSize.aboutToBeDeleted();
2678        this.__primaryTitleFontColorWithTheme.aboutToBeDeleted();
2679        this.__secondaryTitleFontColorWithTheme.aboutToBeDeleted();
2680        this.__titleTextAlign.aboutToBeDeleted();
2681        this.__isButtonVertical.aboutToBeDeleted();
2682        this.__titleMinHeight.aboutToBeDeleted();
2683        SubscriberManager.Get().delete(this.id__());
2684        this.aboutToBeDeletedInternal();
2685    }
2686    get minContentHeight() {
2687        return this.__minContentHeight.get();
2688    }
2689    set minContentHeight(newValue) {
2690        this.__minContentHeight.set(newValue);
2691    }
2692    defaultContentBuilder(parent = null) {
2693    }
2694    get titleHeight() {
2695        return this.__titleHeight.get();
2696    }
2697    set titleHeight(newValue) {
2698        this.__titleHeight.set(newValue);
2699    }
2700    get buttonHeight() {
2701        return this.__buttonHeight.get();
2702    }
2703    set buttonHeight(newValue) {
2704        this.__buttonHeight.set(newValue);
2705    }
2706    get contentMaxHeight() {
2707        return this.__contentMaxHeight.get();
2708    }
2709    set contentMaxHeight(newValue) {
2710        this.__contentMaxHeight.set(newValue);
2711    }
2712    get fontSizeScale() {
2713        return this.__fontSizeScale.get();
2714    }
2715    set fontSizeScale(newValue) {
2716        this.__fontSizeScale.set(newValue);
2717    }
2718    get customStyle() {
2719        return this.__customStyle.get();
2720    }
2721    set customStyle(newValue) {
2722        this.__customStyle.set(newValue);
2723    }
2724    get buttonMaxFontSize() {
2725        return this.__buttonMaxFontSize.get();
2726    }
2727    set buttonMaxFontSize(newValue) {
2728        this.__buttonMaxFontSize.set(newValue);
2729    }
2730    get buttonMinFontSize() {
2731        return this.__buttonMinFontSize.get();
2732    }
2733    set buttonMinFontSize(newValue) {
2734        this.__buttonMinFontSize.set(newValue);
2735    }
2736    get primaryTitleFontSize() {
2737        return this.__primaryTitleFontSize.get();
2738    }
2739    set primaryTitleFontSize(newValue) {
2740        this.__primaryTitleFontSize.set(newValue);
2741    }
2742    get secondaryTitleFontSize() {
2743        return this.__secondaryTitleFontSize.get();
2744    }
2745    set secondaryTitleFontSize(newValue) {
2746        this.__secondaryTitleFontSize.set(newValue);
2747    }
2748    get primaryTitleFontColorWithTheme() {
2749        return this.__primaryTitleFontColorWithTheme.get();
2750    }
2751    set primaryTitleFontColorWithTheme(newValue) {
2752        this.__primaryTitleFontColorWithTheme.set(newValue);
2753    }
2754    get secondaryTitleFontColorWithTheme() {
2755        return this.__secondaryTitleFontColorWithTheme.get();
2756    }
2757    set secondaryTitleFontColorWithTheme(newValue) {
2758        this.__secondaryTitleFontColorWithTheme.set(newValue);
2759    }
2760    get titleTextAlign() {
2761        return this.__titleTextAlign.get();
2762    }
2763    set titleTextAlign(newValue) {
2764        this.__titleTextAlign.set(newValue);
2765    }
2766    get isButtonVertical() {
2767        return this.__isButtonVertical.get();
2768    }
2769    set isButtonVertical(newValue) {
2770        this.__isButtonVertical.set(newValue);
2771    }
2772    get titleMinHeight() {
2773        return this.__titleMinHeight.get();
2774    }
2775    set titleMinHeight(newValue) {
2776        this.__titleMinHeight.set(newValue);
2777    }
2778    initialRender() {
2779        this.observeComponentCreation2((elmtId, isInitialRender) => {
2780            WithTheme.create({ theme: this.theme, colorMode: this.themeColorMode });
2781        }, WithTheme);
2782        this.observeComponentCreation2((elmtId, isInitialRender) => {
2783            RelativeContainer.create();
2784            RelativeContainer.height('auto');
2785        } , RelativeContainer);
2786        this.observeComponentCreation2((elmtId, isInitialRender) => {
2787            Scroll.create(this.scroller);
2788            Scroll.edgeEffect(EdgeEffect.None, { alwaysEnabled: false });
2789            Scroll.backgroundColor(this.themeColorMode === ThemeColorMode.SYSTEM || undefined ?
2790            Color.Transparent : {
2791                    'id': -1,
2792                    'type': 10001,
2793                    params: ['sys.color.comp_background_primary'],
2794                    'bundleName': '__harDefaultBundleName__',
2795                    'moduleName': '__harDefaultModuleName__'
2796                });
2797            Scroll.scrollBar(BarState.Off);
2798            Scroll.id('CustomDialogContentComponent');
2799        }, Scroll);
2800        this.observeComponentCreation2((elmtId, isInitialRender) => {
2801            Column.create();
2802            Column.constraintSize({ maxHeight: this.contentMaxHeight });
2803            Column.backgroundBlurStyle(this.customStyle ?
2804                BlurStyle.Thick : BlurStyle.NONE, undefined, { disableSystemAdaptation: true });
2805            Column.borderRadius(this.customStyle ? {
2806                'id': -1,
2807                'type': 10002,
2808                params: ['sys.float.ohos_id_corner_radius_dialog'],
2809                'bundleName': '__harDefaultBundleName__',
2810                'moduleName': '__harDefaultModuleName__'
2811            } : 0);
2812            Column.margin(this.customStyle ? {
2813                start: LengthMetrics.resource({
2814                    'id': -1,
2815                    'type': 10002,
2816                    params: ['sys.float.ohos_id_dialog_margin_start'],
2817                    'bundleName': '__harDefaultBundleName__',
2818                    'moduleName': '__harDefaultModuleName__'
2819                }),
2820                end: LengthMetrics.resource({
2821                    'id': -1,
2822                    'type': 10002,
2823                    params: ['sys.float.ohos_id_dialog_margin_end'],
2824                    'bundleName': '__harDefaultBundleName__',
2825                    'moduleName': '__harDefaultModuleName__'
2826                }),
2827                bottom: LengthMetrics.resource({
2828                    'id': -1,
2829                    'type': 10002,
2830                    params: ['sys.float.ohos_id_dialog_margin_bottom'],
2831                    'bundleName': '__harDefaultBundleName__',
2832                    'moduleName': '__harDefaultModuleName__'
2833                }),
2834            } : { left: 0, right: 0, bottom: 0 });
2835            Column.backgroundColor(this.customStyle ? {
2836                'id': -1,
2837                'type': 10001,
2838                params: ['sys.color.ohos_id_color_dialog_bg'],
2839                'bundleName': '__harDefaultBundleName__',
2840                'moduleName': '__harDefaultModuleName__'
2841            } : Color.Transparent);
2842        }, Column);
2843        {
2844            this.observeComponentCreation2((elmtId, isInitialRender) => {
2845                if (isInitialRender) {
2846                    let componentCall = new CustomDialogLayout(this, {
2847                        buttonHeight: this.__buttonHeight,
2848                        titleHeight: this.__titleHeight,
2849                        titleMinHeight: this.__titleMinHeight,
2850                        dialogBuilder: () => {
2851                            this.observeComponentCreation2((elmtId, isInitialRender) => {
2852                                ForEach.create();
2853                                const forEachItemGenFunction = _item => {
2854                                    const index = _item;
2855                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
2856                                        If.create();
2857                                        if (index === this.titleIndex) {
2858                                            this.ifElseBranchUpdateFunction(0, () => {
2859                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
2860                                                    WithTheme.create({
2861                                                        theme: this.theme,
2862                                                        colorMode: this.themeColorMode
2863                                                    });
2864                                                }, WithTheme);
2865                                                this.titleBuilder.bind(this)();
2866                                                WithTheme.pop();
2867                                            });
2868                                        } else if (index === this.contentIndex) {
2869                                            this.ifElseBranchUpdateFunction(1, () => {
2870                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
2871                                                    Column.create();
2872                                                    Column.padding(this.getContentPadding());
2873                                                }, Column);
2874                                                this.observeComponentCreation2((elmtId, isInitialRender) => {
2875                                                    WithTheme.create({
2876                                                        theme: this.theme,
2877                                                        colorMode: this.themeColorMode
2878                                                    });
2879                                                }, WithTheme);
2880                                                this.contentBuilder.bind(this)();
2881                                                WithTheme.pop();
2882                                                Column.pop();
2883                                            });
2884                                        } else {
2885                                            this.ifElseBranchUpdateFunction(2, () => {
2886                                                this.buildButton.bind(this)();
2887                                            });
2888                                        }
2889                                    }, If);
2890                                    If.pop();
2891                                };
2892                                this.forEachUpdateFunction(elmtId,
2893                                    [this.titleIndex, this.contentIndex, this.buttonIndex], forEachItemGenFunction);
2894                            }, ForEach);
2895                            ForEach.pop();
2896                        }
2897                    }, undefined, elmtId, () => {
2898                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 1107, col: 11 });
2899                    ViewPU.create(componentCall);
2900                    let paramsLambda = () => {
2901                        return {
2902                            buttonHeight: this.buttonHeight,
2903                            titleHeight: this.titleHeight,
2904                            titleMinHeight: this.titleMinHeight,
2905                            dialogBuilder: () => {
2906                                this.observeComponentCreation2((elmtId, isInitialRender) => {
2907                                    ForEach.create();
2908                                    const forEachItemGenFunction = _item => {
2909                                        const index = _item;
2910                                        this.observeComponentCreation2((elmtId, isInitialRender) => {
2911                                            If.create();
2912                                            if (index === this.titleIndex) {
2913                                                this.ifElseBranchUpdateFunction(0, () => {
2914                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
2915                                                        WithTheme.create({
2916                                                            theme: this.theme,
2917                                                            colorMode: this.themeColorMode
2918                                                        });
2919                                                    }, WithTheme);
2920                                                    this.titleBuilder.bind(this)();
2921                                                    WithTheme.pop();
2922                                                });
2923                                            } else if (index === this.contentIndex) {
2924                                                this.ifElseBranchUpdateFunction(1, () => {
2925                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
2926                                                        Column.create();
2927                                                        Column.padding(this.getContentPadding());
2928                                                    }, Column);
2929                                                    this.observeComponentCreation2((elmtId, isInitialRender) => {
2930                                                        WithTheme.create({
2931                                                            theme: this.theme,
2932                                                            colorMode: this.themeColorMode
2933                                                        });
2934                                                    }, WithTheme);
2935                                                    this.contentBuilder.bind(this)();
2936                                                    WithTheme.pop();
2937                                                    Column.pop();
2938                                                });
2939                                            } else {
2940                                                this.ifElseBranchUpdateFunction(2, () => {
2941                                                    this.buildButton.bind(this)();
2942                                                });
2943                                            }
2944                                        }, If);
2945                                        If.pop();
2946                                    };
2947                                    this.forEachUpdateFunction(elmtId,
2948                                        [this.titleIndex, this.contentIndex, this.buttonIndex], forEachItemGenFunction);
2949                                }, ForEach);
2950                                ForEach.pop();
2951                            }
2952                        };
2953                    };
2954                    componentCall.paramsGenerator_ = paramsLambda;
2955                } else {
2956                    this.updateStateVarsOfChildByElmtId(elmtId, {});
2957                }
2958            }, { name: 'CustomDialogLayout' });
2959        }
2960        Column.pop();
2961        Scroll.pop();
2962        this.observeComponentCreation2((elmtId, isInitialRender) => {
2963            ScrollBar.create({ scroller: this.scroller });
2964            ScrollBar.alignRules({
2965                top: { anchor: 'CustomDialogContentComponent', align: VerticalAlign.Top },
2966                bottom: { anchor: 'CustomDialogContentComponent', align: VerticalAlign.Bottom },
2967                end: { anchor: 'CustomDialogContentComponent', align: HorizontalAlign.End }
2968            });
2969            ScrollBar.margin({
2970                top: {
2971                    'id': -1,
2972                    'type': 10002,
2973                    params: ['sys.float.alert_container_shape'],
2974                    'bundleName': '__harDefaultBundleName__',
2975                    'moduleName': '__harDefaultModuleName__'
2976                },
2977                bottom: {
2978                    'id': -1,
2979                    'type': 10002,
2980                    params: ['sys.float.alert_container_shape'],
2981                    'bundleName': '__harDefaultBundleName__',
2982                    'moduleName': '__harDefaultModuleName__'
2983                }
2984            });
2985            ScrollBar.enableNestedScroll(true);
2986            ScrollBar.hitTestBehavior(HitTestMode.Transparent);
2987            ScrollBar.onGestureRecognizerJudgeBegin((event, current, others) => {
2988                if (current) {
2989                    if (current.getType() == GestureControl.GestureType.LONG_PRESS_GESTURE) {
2990                        return GestureJudgeResult.REJECT;
2991                    }
2992                }
2993                return GestureJudgeResult.CONTINUE;
2994            });
2995        }, ScrollBar);
2996        ScrollBar.pop();
2997        RelativeContainer.pop();
2998        WithTheme.pop();
2999    }
3000    onMeasureSize(selfLayoutInfo, children, constraint) {
3001        let sizeResult = { width: selfLayoutInfo.width, height: selfLayoutInfo.height };
3002        let maxWidth = Number(constraint.maxWidth);
3003        let maxHeight = Number(constraint.maxHeight);
3004        this.fontSizeScale = this.updateFontScale();
3005        this.updateFontSize();
3006        this.isButtonVertical = this.isVerticalAlignButton(maxWidth - BUTTON_HORIZONTAL_MARGIN() * 2);
3007        this.titleMinHeight = this.getTitleAreaMinHeight();
3008        let height = 0;
3009        children.forEach((child) => {
3010            this.contentMaxHeight = '100%';
3011            let measureResult = child.measure(constraint);
3012            if (maxHeight - this.buttonHeight - this.titleHeight < this.minContentHeight) {
3013                this.contentMaxHeight = MAX_CONTENT_HEIGHT;
3014                measureResult = child.measure(constraint);
3015            }
3016            height += measureResult.height;
3017        });
3018        sizeResult.height = height;
3019        sizeResult.width = maxWidth;
3020        return sizeResult;
3021    }
3022    aboutToAppear() {
3023        try {
3024            let uiContext = this.getUIContext();
3025            this.isFollowingSystemFontScale = uiContext?.isFollowingSystemFontScale();
3026            this.appMaxFontScale = uiContext?.getMaxFontScale();
3027        }
3028        catch (err) {
3029            let code = err?.code;
3030            let message = err?.message;
3031            hilog.error(0x3900, 'Ace', `Faild to dialog getUIContext, code: ${code}, message: ${message}`);
3032        }
3033        this.fontSizeScale = this.updateFontScale();
3034        if (this.controller && this.customStyle === undefined) {
3035            let customController = this.controller;
3036            if (customController.arg_ &&
3037                customController.arg_.customStyle &&
3038                customController.arg_.customStyle === true) {
3039                this.customStyle = true;
3040            }
3041        }
3042        if (this.customStyle === undefined) {
3043            this.customStyle = false;
3044        }
3045        this.primaryTitleFontColorWithTheme = this.theme?.colors?.fontPrimary ?
3046        this.theme.colors.fontPrimary : {
3047                'id': -1,
3048                'type': 10001,
3049                params: ['sys.color.font_primary'],
3050                'bundleName': '__harDefaultBundleName__',
3051                'moduleName': '__harDefaultModuleName__'
3052            };
3053        this.secondaryTitleFontColorWithTheme = this.theme?.colors?.fontSecondary ?
3054        this.theme.colors.fontSecondary : {
3055                'id': -1,
3056                'type': 10001,
3057                params: ['sys.color.font_secondary'],
3058                'bundleName': '__harDefaultBundleName__',
3059                'moduleName': '__harDefaultModuleName__'
3060            };
3061        this.initTitleTextAlign();
3062        this.setDefaultFocusState(this.buttons);
3063    }
3064    updateFontSize() {
3065        if (this.fontSizeScale > MAX_FONT_SCALE) {
3066            this.buttonMaxFontSize = BUTTON_MAX_FONT_SIZE() * MAX_FONT_SCALE + 'vp';
3067            this.buttonMinFontSize = BUTTON_MIN_FONT_SIZE() * MAX_FONT_SCALE + 'vp';
3068        } else {
3069            this.buttonMaxFontSize = BUTTON_MAX_FONT_SIZE() + 'fp';
3070            this.buttonMinFontSize = BUTTON_MIN_FONT_SIZE() + 'fp';
3071        }
3072    }
3073    updateFontScale() {
3074        try {
3075            let uiContext = this.getUIContext();
3076            let systemFontScale = uiContext.getHostContext()?.config?.fontSizeScale ?? 1;
3077            if (!this.isFollowingSystemFontScale) {
3078                return 1;
3079            }
3080            return Math.min(systemFontScale, this.appMaxFontScale);
3081        } catch (exception) {
3082            let code = exception.code;
3083            let message = exception.message;
3084            hilog.error(0x3900, 'Ace', `Faild to init fontsizescale info,cause, code: ${code}, message: ${message}`);
3085            return 1;
3086        }
3087    }
3088    getContentPadding() {
3089        if (this.localizedContentAreaPadding) {
3090            return this.localizedContentAreaPadding;
3091        }
3092        if (this.contentAreaPadding) {
3093            return this.contentAreaPadding;
3094        }
3095        if ((this.primaryTitle || this.secondaryTitle) && this.buttons && this.buttons.length > 0) {
3096            return {
3097                top: 0,
3098                right: {
3099                    'id': -1,
3100                    'type': 10002,
3101                    params: ['sys.float.alert_content_default_padding'],
3102                    'bundleName': '__harDefaultBundleName__',
3103                    'moduleName': '__harDefaultModuleName__'
3104                },
3105                bottom: 0,
3106                left: {
3107                    'id': -1,
3108                    'type': 10002,
3109                    params: ['sys.float.alert_content_default_padding'],
3110                    'bundleName': '__harDefaultBundleName__',
3111                    'moduleName': '__harDefaultModuleName__'
3112                },
3113            };
3114        } else if (this.primaryTitle || this.secondaryTitle) {
3115            return {
3116                top: 0,
3117                right: {
3118                    'id': -1,
3119                    'type': 10002,
3120                    params: ['sys.float.alert_content_default_padding'],
3121                    'bundleName': '__harDefaultBundleName__',
3122                    'moduleName': '__harDefaultModuleName__'
3123                },
3124                bottom: {
3125                    'id': -1,
3126                    'type': 10002,
3127                    params: ['sys.float.alert_content_default_padding'],
3128                    'bundleName': '__harDefaultBundleName__',
3129                    'moduleName': '__harDefaultModuleName__'
3130                },
3131                left: {
3132                    'id': -1,
3133                    'type': 10002,
3134                    params: ['sys.float.alert_content_default_padding'],
3135                    'bundleName': '__harDefaultBundleName__',
3136                    'moduleName': '__harDefaultModuleName__'
3137                },
3138            };
3139        } else if (this.buttons && this.buttons.length > 0) {
3140            return {
3141                top: {
3142                    'id': -1,
3143                    'type': 10002,
3144                    params: ['sys.float.alert_content_default_padding'],
3145                    'bundleName': '__harDefaultBundleName__',
3146                    'moduleName': '__harDefaultModuleName__'
3147                },
3148                right: {
3149                    'id': -1,
3150                    'type': 10002,
3151                    params: ['sys.float.alert_content_default_padding'],
3152                    'bundleName': '__harDefaultBundleName__',
3153                    'moduleName': '__harDefaultModuleName__'
3154                },
3155                bottom: 0,
3156                left: {
3157                    'id': -1,
3158                    'type': 10002,
3159                    params: ['sys.float.alert_content_default_padding'],
3160                    'bundleName': '__harDefaultBundleName__',
3161                    'moduleName': '__harDefaultModuleName__'
3162                },
3163            };
3164        } else {
3165            return {
3166                top: {
3167                    'id': -1,
3168                    'type': 10002,
3169                    params: ['sys.float.alert_content_default_padding'],
3170                    'bundleName': '__harDefaultBundleName__',
3171                    'moduleName': '__harDefaultModuleName__'
3172                },
3173                right: {
3174                    'id': -1,
3175                    'type': 10002,
3176                    params: ['sys.float.alert_content_default_padding'],
3177                    'bundleName': '__harDefaultBundleName__',
3178                    'moduleName': '__harDefaultModuleName__'
3179                },
3180                bottom: {
3181                    'id': -1,
3182                    'type': 10002,
3183                    params: ['sys.float.alert_content_default_padding'],
3184                    'bundleName': '__harDefaultBundleName__',
3185                    'moduleName': '__harDefaultModuleName__'
3186                },
3187                left: {
3188                    'id': -1,
3189                    'type': 10002,
3190                    params: ['sys.float.alert_content_default_padding'],
3191                    'bundleName': '__harDefaultBundleName__',
3192                    'moduleName': '__harDefaultModuleName__'
3193                },
3194            };
3195        }
3196    }
3197    titleBuilder(parent = null) {
3198        this.observeComponentCreation2((elmtId, isInitialRender) => {
3199            Column.create();
3200            Column.justifyContent(FlexAlign.Center);
3201            Column.width('100%');
3202            Column.padding(this.getTitleAreaPadding());
3203        }, Column);
3204        this.observeComponentCreation2((elmtId, isInitialRender) => {
3205            Row.create();
3206            Row.width('100%');
3207        }, Row);
3208        this.observeComponentCreation2((elmtId, isInitialRender) => {
3209            Text.create(this.primaryTitle);
3210            Text.fontWeight(TITLE_FONT_WEIGHT());
3211            Text.fontColor(ObservedObject.GetRawObject(this.primaryTitleFontColorWithTheme));
3212            Text.textAlign(this.titleTextAlign);
3213            Text.fontSize(ObservedObject.GetRawObject(this.primaryTitleFontSize));
3214            Text.maxFontScale(Math.min(this.appMaxFontScale, MAX_FONT_SCALE));
3215            Text.maxLines(TITLE_MAX_LINES);
3216            Text.heightAdaptivePolicy(TextHeightAdaptivePolicy.MAX_LINES_FIRST);
3217            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
3218            Text.width('100%');
3219        }, Text);
3220        Text.pop();
3221        Row.pop();
3222        this.observeComponentCreation2((elmtId, isInitialRender) => {
3223            If.create();
3224            if (this.primaryTitle && this.secondaryTitle) {
3225                this.ifElseBranchUpdateFunction(0, () => {
3226                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3227                        Row.create();
3228                        Row.height({
3229                            'id': -1,
3230                            'type': 10002,
3231                            params: ['sys.float.padding_level1'],
3232                            'bundleName': '__harDefaultBundleName__',
3233                            'moduleName': '__harDefaultModuleName__'
3234                        });
3235                    }, Row);
3236                    Row.pop();
3237                });
3238            } else {
3239                this.ifElseBranchUpdateFunction(1, () => {
3240                });
3241            }
3242        }, If);
3243        If.pop();
3244        this.observeComponentCreation2((elmtId, isInitialRender) => {
3245            Row.create();
3246            Row.width('100%');
3247        }, Row);
3248        this.observeComponentCreation2((elmtId, isInitialRender) => {
3249            Text.create(this.secondaryTitle);
3250            Text.fontWeight(FontWeight.Regular);
3251            Text.fontColor(ObservedObject.GetRawObject(this.secondaryTitleFontColorWithTheme));
3252            Text.textAlign(this.titleTextAlign);
3253            Text.fontSize(ObservedObject.GetRawObject(this.secondaryTitleFontSize));
3254            Text.maxFontScale(Math.min(this.appMaxFontScale, MAX_FONT_SCALE));
3255            Text.maxLines(TITLE_MAX_LINES);
3256            Text.heightAdaptivePolicy(TextHeightAdaptivePolicy.MAX_LINES_FIRST);
3257            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
3258            Text.width('100%');
3259        }, Text);
3260        Text.pop();
3261        Row.pop();
3262        Column.pop();
3263    }
3264    getTitleAreaPadding() {
3265        if (this.primaryTitle || this.secondaryTitle) {
3266            return {
3267                top: {
3268                    'id': -1,
3269                    'type': 10002,
3270                    params: ['sys.float.alert_title_padding_top'],
3271                    'bundleName': '__harDefaultBundleName__',
3272                    'moduleName': '__harDefaultModuleName__'
3273                },
3274                right: {
3275                    'id': -1,
3276                    'type': 10002,
3277                    params: ['sys.float.alert_title_padding_right'],
3278                    'bundleName': '__harDefaultBundleName__',
3279                    'moduleName': '__harDefaultModuleName__'
3280                },
3281                left: {
3282                    'id': -1,
3283                    'type': 10002,
3284                    params: ['sys.float.alert_title_padding_left'],
3285                    'bundleName': '__harDefaultBundleName__',
3286                    'moduleName': '__harDefaultModuleName__'
3287                },
3288                bottom: {
3289                    'id': -1,
3290                    'type': 10002,
3291                    params: ['sys.float.alert_title_padding_bottom'],
3292                    'bundleName': '__harDefaultBundleName__',
3293                    'moduleName': '__harDefaultModuleName__'
3294                },
3295            };
3296        }
3297        return {
3298            top: 0,
3299            right: {
3300                'id': -1,
3301                'type': 10002,
3302                params: ['sys.float.alert_title_padding_right'],
3303                'bundleName': '__harDefaultBundleName__',
3304                'moduleName': '__harDefaultModuleName__'
3305            },
3306            left: {
3307                'id': -1,
3308                'type': 10002,
3309                params: ['sys.float.alert_title_padding_left'],
3310                'bundleName': '__harDefaultBundleName__',
3311                'moduleName': '__harDefaultModuleName__'
3312            },
3313            bottom: 0,
3314        };
3315    }
3316    initTitleTextAlign() {
3317        let textAlign = ALERT_TITLE_ALIGNMENT();
3318        if (textAlign === TextAlign.Start) {
3319            this.titleTextAlign = TextAlign.Start;
3320        } else if (textAlign === TextAlign.Center) {
3321            this.titleTextAlign = TextAlign.Center;
3322        } else if (textAlign === TextAlign.End) {
3323            this.titleTextAlign = TextAlign.End;
3324        } else if (textAlign === TextAlign.JUSTIFY) {
3325            this.titleTextAlign = TextAlign.JUSTIFY;
3326        } else {
3327            this.titleTextAlign = TextAlign.Center;
3328        }
3329    }
3330    getTitleAreaMinHeight() {
3331        if (this.secondaryTitle) {
3332            return {
3333                'id': -1,
3334                'type': 10002,
3335                params: ['sys.float.alert_title_secondary_height'],
3336                'bundleName': '__harDefaultBundleName__',
3337                'moduleName': '__harDefaultModuleName__'
3338            };
3339        } else if (this.primaryTitle) {
3340            return {
3341                'id': -1,
3342                'type': 10002,
3343                params: ['sys.float.alert_title_primary_height'],
3344                'bundleName': '__harDefaultBundleName__',
3345                'moduleName': '__harDefaultModuleName__'
3346            };
3347        } else {
3348            return 0;
3349        }
3350    }
3351
3352    setDefaultFocusState(buttonList) {
3353        if (!buttonList) {
3354            return;
3355        }
3356        let falseNum = 0;
3357        buttonList.forEach((button) => {
3358            if (button.defaultFocus) {
3359                this.isHasDefaultFocus = true;
3360            }
3361            if (button.defaultFocus === false) {
3362                falseNum++;
3363            }
3364        });
3365        if (falseNum === buttonList.length) {
3366            this.isAllFocusFalse = true;
3367        }
3368    }
3369    ButtonBuilder(parent = null) {
3370        this.observeComponentCreation2((elmtId, isInitialRender) => {
3371            Column.create();
3372            Column.width('100%');
3373            Column.padding(this.getOperationAreaPadding());
3374        }, Column);
3375        this.observeComponentCreation2((elmtId, isInitialRender) => {
3376            If.create();
3377            if (this.buttons && this.buttons.length > 0) {
3378                this.ifElseBranchUpdateFunction(0, () => {
3379                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3380                        If.create();
3381                        if (this.isButtonVertical) {
3382                            this.ifElseBranchUpdateFunction(0, () => {
3383                                this.buildVerticalAlignButtons.bind(this)();
3384                            });
3385                        } else {
3386                            this.ifElseBranchUpdateFunction(1, () => {
3387                                this.buildHorizontalAlignButtons.bind(this)();
3388                            });
3389                        }
3390                    }, If);
3391                    If.pop();
3392                });
3393            } else {
3394                this.ifElseBranchUpdateFunction(1, () => {
3395                });
3396            }
3397        }, If);
3398        If.pop();
3399        Column.pop();
3400    }
3401
3402    isSetCustomButtonTheme() {
3403        // is set fadeout style: now only on TV
3404        if (IS_FADEOUT_ENABLE()) {
3405            // has set button background color prop
3406            if (this.theme?.colors?.compBackgroundTertiary || this.theme?.colors?.backgroundEmphasize) {
3407                return true;
3408            }
3409            // has set button font color prop
3410            if (this.theme?.colors?.fontEmphasize || this.theme?.colors?.fontOnPrimary || this.theme?.colors?.warning) {
3411                return true;
3412            }
3413            return false;
3414        }
3415        return true;
3416    }
3417
3418    buildButton(parent = null) {
3419        this.observeComponentCreation2((elmtId, isInitialRender) => {
3420            If.create();
3421            if (this.isSetCustomButtonTheme()) {
3422                this.ifElseBranchUpdateFunction(0, () => {
3423                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3424                        WithTheme.create({ theme: this.theme, colorMode: this.themeColorMode });
3425                    }, WithTheme);
3426                    this.ButtonBuilder.bind(this)();
3427                    WithTheme.pop();
3428                });
3429            } else {
3430                this.ifElseBranchUpdateFunction(1, () => {
3431                    this.ButtonBuilder.bind(this)();
3432                });
3433            }
3434        }, If);
3435        If.pop();
3436    }
3437
3438    getOperationAreaPadding() {
3439        if (this.isButtonVertical) {
3440            return {
3441                top: {
3442                    'id': -1,
3443                    'type': 10002,
3444                    params: ['sys.float.alert_button_top_padding'],
3445                    'bundleName': '__harDefaultBundleName__',
3446                    'moduleName': '__harDefaultModuleName__'
3447                },
3448                right: {
3449                    'id': -1,
3450                    'type': 10002,
3451                    params: ['sys.float.alert_right_padding_vertical'],
3452                    'bundleName': '__harDefaultBundleName__',
3453                    'moduleName': '__harDefaultModuleName__'
3454                },
3455                left: {
3456                    'id': -1,
3457                    'type': 10002,
3458                    params: ['sys.float.alert_left_padding_vertical'],
3459                    'bundleName': '__harDefaultBundleName__',
3460                    'moduleName': '__harDefaultModuleName__'
3461                },
3462                bottom: {
3463                    'id': -1,
3464                    'type': 10002,
3465                    params: ['sys.float.alert_button_bottom_padding_vertical'],
3466                    'bundleName': '__harDefaultBundleName__',
3467                    'moduleName': '__harDefaultModuleName__'
3468                },
3469            };
3470        }
3471        return {
3472            top: {
3473                'id': -1,
3474                'type': 10002,
3475                params: ['sys.float.alert_button_top_padding'],
3476                'bundleName': '__harDefaultBundleName__',
3477                'moduleName': '__harDefaultModuleName__'
3478            },
3479            right: {
3480                'id': -1,
3481                'type': 10002,
3482                params: ['sys.float.alert_right_padding_horizontal'],
3483                'bundleName': '__harDefaultBundleName__',
3484                'moduleName': '__harDefaultModuleName__'
3485            },
3486            left: {
3487                'id': -1,
3488                'type': 10002,
3489                params: ['sys.float.alert_left_padding_horizontal'],
3490                'bundleName': '__harDefaultBundleName__',
3491                'moduleName': '__harDefaultModuleName__'
3492            },
3493            bottom: {
3494                'id': -1,
3495                'type': 10002,
3496                params: ['sys.float.alert_button_bottom_padding_horizontal'],
3497                'bundleName': '__harDefaultBundleName__',
3498                'moduleName': '__harDefaultModuleName__'
3499            },
3500        };
3501    }
3502    buildSingleButton(buttonOptions, parent = null) {
3503        this.observeComponentCreation2((elmtId, isInitialRender) => {
3504            If.create();
3505            if (this.isNewPropertiesHighPriority(buttonOptions)) {
3506                this.ifElseBranchUpdateFunction(0, () => {
3507                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3508                        Button.createWithLabel(buttonOptions.value);
3509                        __Button__setButtonProperties(
3510                            buttonOptions, this.isHasDefaultFocus, this.isAllFocusFalse, this.controller);
3511                        Button.role(buttonOptions.role ?? ButtonRole.NORMAL);
3512                        Button.key(`advanced_dialog_button_${this.keyIndex++}`);
3513                        Button.labelStyle({
3514                            maxLines: 1,
3515                            overflow: IS_FADEOUT_ENABLE() ? TextOverflow.MARQUEE : TextOverflow.Ellipsis,
3516                            maxFontSize: this.buttonMaxFontSize,
3517                            minFontSize: this.buttonMinFontSize
3518                        });
3519                    }, Button);
3520                    Button.pop();
3521                });
3522            } else if (buttonOptions.background !== undefined && buttonOptions.fontColor !== undefined) {
3523                this.ifElseBranchUpdateFunction(1, () => {
3524                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3525                        Button.createWithLabel(buttonOptions.value);
3526                        __Button__setButtonProperties(
3527                            buttonOptions, this.isHasDefaultFocus, this.isAllFocusFalse, this.controller);
3528                        Button.backgroundColor(buttonOptions.background);
3529                        Button.fontColor(buttonOptions.fontColor);
3530                        Button.key(`advanced_dialog_button_${this.keyIndex++}`);
3531                        Button.labelStyle({
3532                            maxLines: 1,
3533                            overflow: IS_FADEOUT_ENABLE() ? TextOverflow.MARQUEE : TextOverflow.Ellipsis,
3534                            maxFontSize: this.buttonMaxFontSize,
3535                            minFontSize: this.buttonMinFontSize
3536                        });
3537                    }, Button);
3538                    Button.pop();
3539                });
3540            } else if (buttonOptions.background !== undefined) {
3541                this.ifElseBranchUpdateFunction(2, () => {
3542                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3543                        Button.createWithLabel(buttonOptions.value);
3544                        __Button__setButtonProperties(
3545                            buttonOptions, this.isHasDefaultFocus, this.isAllFocusFalse, this.controller);
3546                        Button.backgroundColor(buttonOptions.background);
3547                        Button.key(`advanced_dialog_button_${this.keyIndex++}`);
3548                        Button.labelStyle({
3549                            maxLines: 1,
3550                            overflow: IS_FADEOUT_ENABLE() ? TextOverflow.MARQUEE : TextOverflow.Ellipsis,
3551                            maxFontSize: this.buttonMaxFontSize,
3552                            minFontSize: this.buttonMinFontSize
3553                        });
3554                    }, Button);
3555                    Button.pop();
3556                });
3557            } else {
3558                this.ifElseBranchUpdateFunction(3, () => {
3559                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3560                        Button.createWithLabel(buttonOptions.value);
3561                        __Button__setButtonProperties(
3562                            buttonOptions, this.isHasDefaultFocus, this.isAllFocusFalse, this.controller);
3563                        Button.fontColor(buttonOptions.fontColor);
3564                        Button.key(`advanced_dialog_button_${this.keyIndex++}`);
3565                        Button.labelStyle({
3566                            maxLines: 1,
3567                            overflow: IS_FADEOUT_ENABLE() ? TextOverflow.MARQUEE : TextOverflow.Ellipsis,
3568                            maxFontSize: this.buttonMaxFontSize,
3569                            minFontSize: this.buttonMinFontSize
3570                        });
3571                    }, Button);
3572                    Button.pop();
3573                });
3574            }
3575        }, If);
3576        If.pop();
3577    }
3578    buildHorizontalAlignButtons(parent = null) {
3579        this.observeComponentCreation2((elmtId, isInitialRender) => {
3580            If.create();
3581            if (this.buttons && this.buttons.length > 0) {
3582                this.ifElseBranchUpdateFunction(0, () => {
3583                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3584                        Row.create();
3585                    }, Row);
3586                    this.buildSingleButton.bind(this)(this.buttons[0]);
3587                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3588                        If.create();
3589                        if (this.buttons.length === HORIZON_BUTTON_MAX_COUNT) {
3590                            this.ifElseBranchUpdateFunction(0, () => {
3591                                this.observeComponentCreation2((elmtId, isInitialRender) => {
3592                                    Row.create();
3593                                    Row.width(BUTTON_HORIZONTAL_SPACE() * 2);
3594                                    Row.justifyContent(FlexAlign.Center);
3595                                }, Row);
3596                                this.observeComponentCreation2((elmtId, isInitialRender) => {
3597                                    Divider.create();
3598                                    Divider.width({
3599                                        'id': -1,
3600                                        'type': 10002,
3601                                        params: ['sys.float.alert_divider_width'],
3602                                        'bundleName': '__harDefaultBundleName__',
3603                                        'moduleName': '__harDefaultModuleName__'
3604                                    });
3605                                    Divider.height({
3606                                        'id': -1,
3607                                        'type': 10002,
3608                                        params: ['sys.float.alert_divider_height'],
3609                                        'bundleName': '__harDefaultBundleName__',
3610                                        'moduleName': '__harDefaultModuleName__'
3611                                    });
3612                                    Divider.color(this.getDividerColor());
3613                                    Divider.vertical(true);
3614                                }, Divider);
3615                                Row.pop();
3616                                this.buildSingleButton.bind(this)(this.buttons[HORIZON_BUTTON_MAX_COUNT - 1]);
3617                            });
3618                        } else {
3619                            this.ifElseBranchUpdateFunction(1, () => {
3620                            });
3621                        }
3622                    }, If);
3623                    If.pop();
3624                    Row.pop();
3625                });
3626            } else {
3627                this.ifElseBranchUpdateFunction(1, () => {
3628                });
3629            }
3630        }, If);
3631        If.pop();
3632    }
3633    buildVerticalAlignButtons(parent = null) {
3634        this.observeComponentCreation2((elmtId, isInitialRender) => {
3635            If.create();
3636            if (this.buttons) {
3637                this.ifElseBranchUpdateFunction(0, () => {
3638                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3639                        Column.create();
3640                    }, Column);
3641                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3642                        ForEach.create();
3643                        const forEachItemGenFunction = (_item, index) => {
3644                            const item = _item;
3645                            this.buildButtonWithDivider.bind(this)(this.buttons?.length === HORIZON_BUTTON_MAX_COUNT ?
3646                                HORIZON_BUTTON_MAX_COUNT - index - 1 : index);
3647                        };
3648                        this.forEachUpdateFunction(elmtId, this.buttons.slice(0, VERTICAL_BUTTON_MAX_COUNT),
3649                            forEachItemGenFunction, (item) => item.value.toString(), true, false);
3650                    }, ForEach);
3651                    ForEach.pop();
3652                    Column.pop();
3653                });
3654            } else {
3655                this.ifElseBranchUpdateFunction(1, () => {
3656                });
3657            }
3658        }, If);
3659        If.pop();
3660    }
3661    getDividerColor() {
3662        if (!this.buttons || this.buttons.length === 0 || !DIALOG_DIVIDER_SHOW()) {
3663            return Color.Transparent;
3664        }
3665        if (this.buttons[0].buttonStyle === ButtonStyleMode.TEXTUAL || this.buttons[0].buttonStyle === undefined) {
3666            if (this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === ButtonStyleMode.TEXTUAL ||
3667                this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === undefined) {
3668                return {
3669                    'id': -1,
3670                    'type': 10001,
3671                    params: ['sys.color.alert_divider_color'],
3672                    'bundleName': '__harDefaultBundleName__',
3673                    'moduleName': '__harDefaultModuleName__'
3674                };
3675            }
3676        }
3677        return Color.Transparent;
3678    }
3679    isNewPropertiesHighPriority(buttonOptions) {
3680        if (buttonOptions.role === ButtonRole.ERROR) {
3681            return true;
3682        }
3683        if (buttonOptions.buttonStyle !== undefined &&
3684            buttonOptions.buttonStyle !== ALERT_BUTTON_STYLE()) {
3685            return true;
3686        }
3687        if (buttonOptions.background === undefined && buttonOptions.fontColor === undefined) {
3688            return true;
3689        }
3690        return false;
3691    }
3692    buildButtonWithDivider(index, parent = null) {
3693        this.observeComponentCreation2((elmtId, isInitialRender) => {
3694            If.create();
3695            if (this.buttons && this.buttons[index]) {
3696                this.ifElseBranchUpdateFunction(0, () => {
3697                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3698                        Row.create();
3699                    }, Row);
3700                    this.buildSingleButton.bind(this)(this.buttons[index]);
3701                    Row.pop();
3702                    this.observeComponentCreation2((elmtId, isInitialRender) => {
3703                        If.create();
3704                        if ((this.buttons.length === HORIZON_BUTTON_MAX_COUNT ? HORIZON_BUTTON_MAX_COUNT - index - 1 : index) <
3705                            Math.min(this.buttons.length, VERTICAL_BUTTON_MAX_COUNT) - 1) {
3706                            this.ifElseBranchUpdateFunction(0, () => {
3707                                this.observeComponentCreation2((elmtId, isInitialRender) => {
3708                                    Row.create();
3709                                    Row.height({
3710                                        'id': -1,
3711                                        'type': 10002,
3712                                        params: ['sys.float.alert_button_vertical_space'],
3713                                        'bundleName': '__harDefaultBundleName__',
3714                                        'moduleName': '__harDefaultModuleName__'
3715                                    });
3716                                }, Row);
3717                                Row.pop();
3718                            });
3719                        } else {
3720                            this.ifElseBranchUpdateFunction(1, () => {
3721                            });
3722                        }
3723                    }, If);
3724                    If.pop();
3725                });
3726            } else {
3727                this.ifElseBranchUpdateFunction(1, () => {
3728                });
3729            }
3730        }, If);
3731        If.pop();
3732    }
3733    isVerticalAlignButton(width) {
3734        if (this.buttons) {
3735            if (this.buttons.length === 1) {
3736                return false;
3737            }
3738            if (this.buttons.length !== HORIZON_BUTTON_MAX_COUNT) {
3739                return true;
3740            }
3741            let isVertical = false;
3742            let maxButtonTextSize = vp2px(width / HORIZON_BUTTON_MAX_COUNT - BUTTON_HORIZONTAL_MARGIN() -
3743                BUTTON_HORIZONTAL_SPACE() - 2 * BUTTON_HORIZONTAL_PADDING);
3744            this.buttons.forEach((button) => {
3745                try {
3746                    let contentSize = measure.measureTextSize({
3747                        textContent: button.value,
3748                        fontSize: this.buttonMaxFontSize
3749                    });
3750                    if (Number(contentSize?.width) > maxButtonTextSize) {
3751                        isVertical = true;
3752                    }
3753                } catch (err) {
3754                    let code = (err).code;
3755                    let message = (err).message;
3756                    hilog.error(0x3900, 'Ace', `Faild to dialog isVerticalAlignButton measureTextSize,cause,
3757                    code: ${code}, message: ${message}`);
3758                }
3759            });
3760            return isVertical;
3761        }
3762        return false;
3763    }
3764    rerender() {
3765        this.updateDirtyElements();
3766    }
3767}
3768function __Button__setButtonProperties(buttonOptions, isHasDefaultFocus, isAllFocusFalse, controller) {
3769    Button.onKeyEvent((event) => {
3770        if (!event) {
3771            return;
3772        }
3773        if ((event.keyCode === KeyCode.KEYCODE_SPACE || event.keyCode === KeyCode.KEYCODE_ENTER) &&
3774            event.type === KeyType.Down) {
3775            if (buttonOptions.action) {
3776                buttonOptions.action();
3777            }
3778            closeDialog(controller, 'onKeyEvent');
3779            event.stopPropagation();
3780        }
3781    });
3782    Button.onClick(() => {
3783        if (buttonOptions.action) {
3784            buttonOptions.action();
3785        }
3786        closeDialog(controller, 'onClick');
3787    });
3788    Button.defaultFocus(isDefaultFocus(buttonOptions, isHasDefaultFocus, isAllFocusFalse));
3789    Button.buttonStyle(buttonOptions.buttonStyle ??
3790        (buttonOptions.role === ButtonRole.ERROR ? ERROR_BUTTON_STYLE() : ALERT_BUTTON_STYLE()));
3791    Button.layoutWeight(BUTTON_LAYOUT_WEIGHT);
3792    Button.type(ButtonType.ROUNDED_RECTANGLE);
3793}
3794function closeDialog(controller, funcName) {
3795    if (controller) {
3796        hilog?.info(0x3900, 'Ace', `AdvancedDialog button ${funcName} controller true`);
3797        controller?.close();
3798    } else {
3799        hilog?.info(0x3900, 'Ace', `AdvancedDialog button ${funcName} controller false`);
3800    }
3801}
3802function isDefaultFocus(singleButton, isHasDefaultFocus, isAllFocusFalse) {
3803    try {
3804        if (singleButton.defaultFocus) {
3805            return true;
3806        }
3807        let isDefaultFocus = false;
3808        if (isHasDefaultFocus || isAllFocusFalse) {
3809            isDefaultFocus = false;
3810        } else {
3811            isDefaultFocus = true;
3812        }
3813        return isDefaultFocus;
3814    } catch (error) {
3815        let code = error.code;
3816        let message = error.message;
3817        hilog.error(0x3900, 'Ace', `get defaultFocus exist error, code: ${code}, message: ${message}`);
3818        return true;
3819    }
3820}
3821function getNumberByResourceId(resourceId, defaultValue, allowZero) {
3822    try {
3823        let sourceValue = resourceManager.getSystemResourceManager().getNumber(resourceId);
3824        if (sourceValue > 0 || allowZero) {
3825            return sourceValue;
3826        } else {
3827            return defaultValue;
3828        }
3829    } catch (error) {
3830        let code = error.code;
3831        let message = error.message;
3832        hilog.error(0x3900, 'Ace', `CustomContentDialog getNumberByResourceId error, code: ${code}, message: ${message}`);
3833        return defaultValue;
3834    }
3835}
3836function lazyInit(initializer) {
3837    let value = null;
3838    return () => {
3839        if (value === null) {
3840            value = initializer();
3841        }
3842        return value;
3843    };
3844}
3845function getLengthMetricsByResource(resource, defaultValue, isAllowZero) {
3846    if (!resource) {
3847        hilog.error(0x3900, 'Ace', 'CustomContentDialog getLengthMetricsByResource error');
3848        return defaultValue;
3849    }
3850    try {
3851        let sourceValue = LengthMetrics.resource(resource).value;
3852        if (sourceValue === 0) {
3853            return isAllowZero ? sourceValue : defaultValue;
3854        }
3855        return sourceValue;
3856    } catch (error) {
3857        let code = error.code;
3858        let message = error.message;
3859        hilog.error(0x3900, 'Ace',
3860            `CustomContentDialog getLengthMetricsByResource error, code: ${code}, message: ${message}`);
3861        return defaultValue;
3862    }
3863}
3864function getString(resourceId) {
3865    let res = '';
3866    if (resourceId <= 0) {
3867        hilog.error(0x3900, 'Ace', 'CustomContentDialog getString error');
3868        return res;
3869    }
3870    try {
3871        res = getContext().resourceManager.getStringSync(resourceId);
3872    } catch (error) {
3873        let code = error.code;
3874        let message = error.message;
3875        hilog.error(0x3900, 'Ace', `CustomContentDialog getString error, code: ${code}, message: ${message}`);
3876    }
3877    return res;
3878}
3879function getAccessibilityText(resource, selected) {
3880    try {
3881        let selectText = getContext().resourceManager.getStringSync(125833934);
3882        let resourceString = '';
3883        if (typeof resource === 'string') {
3884            resourceString = resource;
3885        } else {
3886            resourceString = getContext().resourceManager.getStringSync(resource);
3887        }
3888        return selected ? `${selectText},${resourceString}` : resourceString;
3889    } catch (error) {
3890        let code = error.code;
3891        let message = error.message;
3892        hilog.error(0x3900, 'Ace', `getAccessibilityText error, code: ${code}, message: ${message}`);
3893        return '';
3894    }
3895}
3896function resolveKeyEvent(event, controller) {
3897    if (event.type === IGNORE_KEY_EVENT_TYPE) {
3898        return;
3899    }
3900    if (event.keyCode === KEYCODE_UP) {
3901        controller.scrollPage({ next: false });
3902        event.stopPropagation();
3903    } else if (event.keyCode === KEYCODE_DOWN) {
3904        if (controller.isAtEnd()) {
3905            return;
3906        } else {
3907            controller.scrollPage({ next: true });
3908            event.stopPropagation();
3909        }
3910    }
3911}
3912function getCheckTipsAccessibilityText(resource, selected) {
3913    try {
3914        let selectText = getContext().resourceManager.getStringSync(125833934);
3915        let unselectText = getContext().resourceManager.getStringSync(125833935);
3916        let checkBoxText = getContext().resourceManager.getStringSync(125834354);
3917        let resourceString = '';
3918        if (typeof resource === 'string') {
3919            resourceString = resource;
3920        } else {
3921            resourceString = getContext().resourceManager.getStringSync(resource);
3922        }
3923        return selected ? `${selectText},${resourceString},${checkBoxText}` :
3924            `${unselectText},${resourceString},${checkBoxText}`;
3925    } catch (error) {
3926        let code = error.code;
3927        let message = error.message;
3928        hilog.error(0x3900, 'Ace', `getCheckTipsAccessibilityText error, code: ${code}, message: ${message}`);
3929        return '';
3930    }
3931}
3932export class LoadingDialog extends ViewPU {
3933    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
3934        super(parent, __localStorage, elmtId, extraInfo);
3935        if (typeof paramsLambda === 'function') {
3936            this.paramsGenerator_ = paramsLambda;
3937        }
3938        this.controller = undefined;
3939        this.content = '';
3940        this.__fontColorWithTheme = new ObservedPropertyObjectPU({
3941            'id': -1,
3942            'type': 10001,
3943            params: ['sys.color.font_primary'],
3944            'bundleName': '__harDefaultBundleName__',
3945            'moduleName': '__harDefaultModuleName__'
3946        }, this, 'fontColorWithTheme');
3947        this.__loadingProgressIconColorWithTheme = new ObservedPropertyObjectPU({
3948            'id': -1,
3949            'type': 10001,
3950            params: ['sys.color.icon_secondary'],
3951            'bundleName': '__harDefaultBundleName__',
3952            'moduleName': '__harDefaultModuleName__'
3953        }, this, 'loadingProgressIconColorWithTheme');
3954        this.theme = new CustomThemeImpl({});
3955        this.themeColorMode = ThemeColorMode.SYSTEM;
3956        this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale');
3957        this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight');
3958        this.setInitiallyProvidedValue(params);
3959        this.finalizeConstruction();
3960    }
3961    setInitiallyProvidedValue(params) {
3962        if (params.controller !== undefined) {
3963            this.controller = params.controller;
3964        }
3965        if (params.content !== undefined) {
3966            this.content = params.content;
3967        }
3968        if (params.fontColorWithTheme !== undefined) {
3969            this.fontColorWithTheme = params.fontColorWithTheme;
3970        }
3971        if (params.loadingProgressIconColorWithTheme !== undefined) {
3972            this.loadingProgressIconColorWithTheme = params.loadingProgressIconColorWithTheme;
3973        }
3974        if (params.theme !== undefined) {
3975            this.theme = params.theme;
3976        }
3977        if (params.themeColorMode !== undefined) {
3978            this.themeColorMode = params.themeColorMode;
3979        }
3980        if (params.fontSizeScale !== undefined) {
3981            this.fontSizeScale = params.fontSizeScale;
3982        }
3983        if (params.minContentHeight !== undefined) {
3984            this.minContentHeight = params.minContentHeight;
3985        }
3986    }
3987    updateStateVars(params) {
3988    }
3989    purgeVariableDependenciesOnElmtId(rmElmtId) {
3990        this.__fontColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
3991        this.__loadingProgressIconColorWithTheme.purgeDependencyOnElmtId(rmElmtId);
3992        this.__fontSizeScale.purgeDependencyOnElmtId(rmElmtId);
3993        this.__minContentHeight.purgeDependencyOnElmtId(rmElmtId);
3994    }
3995    aboutToBeDeleted() {
3996        this.__fontColorWithTheme.aboutToBeDeleted();
3997        this.__loadingProgressIconColorWithTheme.aboutToBeDeleted();
3998        this.__fontSizeScale.aboutToBeDeleted();
3999        this.__minContentHeight.aboutToBeDeleted();
4000        SubscriberManager.Get().delete(this.id__());
4001        this.aboutToBeDeletedInternal();
4002    }
4003    setController(ctr) {
4004        this.controller = ctr;
4005    }
4006    get fontColorWithTheme() {
4007        return this.__fontColorWithTheme.get();
4008    }
4009    set fontColorWithTheme(newValue) {
4010        this.__fontColorWithTheme.set(newValue);
4011    }
4012    get loadingProgressIconColorWithTheme() {
4013        return this.__loadingProgressIconColorWithTheme.get();
4014    }
4015    set loadingProgressIconColorWithTheme(newValue) {
4016        this.__loadingProgressIconColorWithTheme.set(newValue);
4017    }
4018    get fontSizeScale() {
4019        return this.__fontSizeScale.get();
4020    }
4021    set fontSizeScale(newValue) {
4022        this.__fontSizeScale.set(newValue);
4023    }
4024    get minContentHeight() {
4025        return this.__minContentHeight.get();
4026    }
4027    set minContentHeight(newValue) {
4028        this.__minContentHeight.set(newValue);
4029    }
4030    initialRender() {
4031        this.observeComponentCreation2((elmtId, isInitialRender) => {
4032            Column.create();
4033        }, Column);
4034        this.observeComponentCreation2((elmtId, isInitialRender) => {
4035            __Common__.create();
4036            __Common__.constraintSize({ maxHeight: '100%' });
4037        }, __Common__);
4038        {
4039            this.observeComponentCreation2((elmtId, isInitialRender) => {
4040                if (isInitialRender) {
4041                    let componentCall = new CustomDialogContentComponent(this, {
4042                        controller: this.controller,
4043                        contentBuilder: () => {
4044                            this.contentBuilder();
4045                        },
4046                        theme: this.theme,
4047                        themeColorMode: this.themeColorMode,
4048                        fontSizeScale: this.__fontSizeScale,
4049                        minContentHeight: this.__minContentHeight,
4050                    }, undefined, elmtId, () => {
4051                    }, { page: 'library/src/main/ets/components/MainPage.ets', line: 1831, col: 7 });
4052                    ViewPU.create(componentCall);
4053                    let paramsLambda = () => {
4054                        return {
4055                            controller: this.controller,
4056                            contentBuilder: () => {
4057                                this.contentBuilder();
4058                            },
4059                            theme: this.theme,
4060                            themeColorMode: this.themeColorMode,
4061                            fontSizeScale: this.fontSizeScale,
4062                            minContentHeight: this.minContentHeight
4063                        };
4064                    };
4065                    componentCall.paramsGenerator_ = paramsLambda;
4066                } else {
4067                    this.updateStateVarsOfChildByElmtId(elmtId, {});
4068                }
4069            }, { name: 'CustomDialogContentComponent' });
4070        }
4071        __Common__.pop();
4072        Column.pop();
4073    }
4074    contentBuilder(parent = null) {
4075        this.observeComponentCreation2((elmtId, isInitialRender) => {
4076            Column.create();
4077        }, Column);
4078        this.observeComponentCreation2((elmtId, isInitialRender) => {
4079            Row.create();
4080            Row.constraintSize({ minHeight: LOADING_MIN_HEIGHT });
4081        }, Row);
4082        this.observeComponentCreation2((elmtId, isInitialRender) => {
4083            Text.create(this.content);
4084            Text.fontSize(`${CONTENT_FONT_SIZE()}fp`);
4085            Text.fontWeight(FontWeight.Regular);
4086            Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme));
4087            Text.layoutWeight(LOADING_TEXT_LAYOUT_WEIGHT);
4088            Text.maxLines(this.fontSizeScale > MAX_FONT_SCALE ? LOADING_MAX_LINES_BIG_FONT : LOADING_MAX_LINES);
4089            Text.focusable(true);
4090            Text.defaultFocus(true);
4091            Text.focusBox({
4092                strokeWidth: LengthMetrics.px(0)
4093            });
4094            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
4095        }, Text);
4096        Text.pop();
4097        this.observeComponentCreation2((elmtId, isInitialRender) => {
4098            LoadingProgress.create();
4099            LoadingProgress.color(ObservedObject.GetRawObject(this.loadingProgressIconColorWithTheme));
4100            LoadingProgress.width(LOADING_PROGRESS_WIDTH);
4101            LoadingProgress.height(LOADING_PROGRESS_HEIGHT);
4102            LoadingProgress.margin({ start: LengthMetrics.vp(LOADING_TEXT_MARGIN_LEFT) });
4103        }, LoadingProgress);
4104        Row.pop();
4105        Column.pop();
4106    }
4107    aboutToAppear() {
4108        this.fontColorWithTheme = this.theme?.colors?.fontPrimary ?
4109        this.theme.colors.fontPrimary : {
4110                'id': -1,
4111                'type': 10001,
4112                params: ['sys.color.font_primary'],
4113                'bundleName': '__harDefaultBundleName__',
4114                'moduleName': '__harDefaultModuleName__'
4115            };
4116        this.loadingProgressIconColorWithTheme = this.theme?.colors?.iconSecondary ?
4117        this.theme.colors.iconSecondary : {
4118                'id': -1,
4119                'type': 10001,
4120                params: ['sys.color.icon_secondary'],
4121                'bundleName': '__harDefaultBundleName__',
4122                'moduleName': '__harDefaultModuleName__'
4123            };
4124    }
4125    rerender() {
4126        this.updateDirtyElements();
4127    }
4128}
4129export class PopoverDialog extends ViewPU {
4130    constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
4131        super(parent, __localStorage, elmtId, extraInfo);
4132        if (typeof paramsLambda === 'function') {
4133            this.paramsGenerator_ = paramsLambda;
4134        }
4135        this.__visible = new SynchedPropertySimpleTwoWayPU(params.visible, this, 'visible');
4136        this.__popover = new SynchedPropertyObjectOneWayPU(params.popover, this, 'popover');
4137        this.targetBuilder = undefined;
4138        this.__dialogWidth = new ObservedPropertyObjectPU(this.popover?.width, this, 'dialogWidth');
4139        this.setInitiallyProvidedValue(params);
4140        this.finalizeConstruction();
4141    }
4142    setInitiallyProvidedValue(params) {
4143        if (params.targetBuilder !== undefined) {
4144            this.targetBuilder = params.targetBuilder;
4145        }
4146        if (params.dialogWidth !== undefined) {
4147            this.dialogWidth = params.dialogWidth;
4148        }
4149    }
4150    updateStateVars(params) {
4151        this.__popover.reset(params.popover);
4152    }
4153    purgeVariableDependenciesOnElmtId(rmElmtId) {
4154        this.__visible.purgeDependencyOnElmtId(rmElmtId);
4155        this.__popover.purgeDependencyOnElmtId(rmElmtId);
4156        this.__dialogWidth.purgeDependencyOnElmtId(rmElmtId);
4157    }
4158    aboutToBeDeleted() {
4159        this.__visible.aboutToBeDeleted();
4160        this.__popover.aboutToBeDeleted();
4161        this.__dialogWidth.aboutToBeDeleted();
4162        SubscriberManager.Get().delete(this.id__());
4163        this.aboutToBeDeletedInternal();
4164    }
4165    get visible() {
4166        return this.__visible.get();
4167    }
4168    set visible(newValue) {
4169        this.__visible.set(newValue);
4170    }
4171    get popover() {
4172        return this.__popover.get();
4173    }
4174    set popover(newValue) {
4175        this.__popover.set(newValue);
4176    }
4177    get dialogWidth() {
4178        return this.__dialogWidth.get();
4179    }
4180    set dialogWidth(newValue) {
4181        this.__dialogWidth.set(newValue);
4182    }
4183    emptyBuilder(parent = null) {
4184    }
4185    aboutToAppear() {
4186        if (this.targetBuilder === undefined || this.targetBuilder === null) {
4187            this.targetBuilder = this.emptyBuilder;
4188        }
4189    }
4190    initialRender() {
4191        this.observeComponentCreation2((elmtId, isInitialRender) => {
4192            Column.create();
4193            Column.onClick(() => {
4194                try {
4195                    let screenSize = display.getDefaultDisplaySync();
4196                    let screenWidth = px2vp(screenSize.width);
4197                    if (screenWidth - BUTTON_HORIZONTAL_MARGIN() - BUTTON_HORIZONTAL_MARGIN() > MAX_DIALOG_WIDTH) {
4198                        this.popover.width = this.popover?.width ?? MAX_DIALOG_WIDTH;
4199                    } else {
4200                        this.popover.width = this.dialogWidth;
4201                    }
4202                    this.visible = !this.visible;
4203                } catch (error) {
4204                    let code = error.code;
4205                    let message = error.message;
4206                    hilog.error(0x3900, 'Ace', `dialog popup error, code: ${code}, message: ${message}`);
4207                }
4208            });
4209            Column.bindPopup(this.visible, {
4210                builder: this.popover?.builder,
4211                placement: this.popover?.placement ?? Placement.Bottom,
4212                popupColor: this.popover?.popupColor,
4213                enableArrow: this.popover?.enableArrow ?? true,
4214                autoCancel: this.popover?.autoCancel,
4215                onStateChange: this.popover?.onStateChange ?? ((e) => {
4216                    if (!e.isVisible) {
4217                        this.visible = false;
4218                    }
4219                }),
4220                arrowOffset: this.popover?.arrowOffset,
4221                showInSubWindow: this.popover?.showInSubWindow,
4222                mask: this.popover?.mask,
4223                targetSpace: this.popover?.targetSpace,
4224                offset: this.popover?.offset,
4225                width: this.popover?.width,
4226                arrowPointPosition: this.popover?.arrowPointPosition,
4227                arrowWidth: this.popover?.arrowWidth,
4228                arrowHeight: this.popover?.arrowHeight,
4229                radius: this.popover?.radius ?? {
4230                    'id': -1,
4231                    'type': 10002,
4232                    params: ['sys.float.corner_radius_level16'],
4233                    'bundleName': '__harDefaultBundleName__',
4234                    'moduleName': '__harDefaultModuleName__'
4235                },
4236                shadow: this.popover?.shadow ?? ShadowStyle.OUTER_DEFAULT_MD,
4237                backgroundBlurStyle: this.popover?.backgroundBlurStyle ?? BlurStyle.COMPONENT_ULTRA_THICK,
4238                focusable: this.popover?.focusable,
4239                transition: this.popover?.transition,
4240                onWillDismiss: this.popover?.onWillDismiss
4241            });
4242        }, Column);
4243        this.targetBuilder.bind(this)();
4244        Column.pop();
4245    }
4246    rerender() {
4247        this.updateDirtyElements();
4248    }
4249}
4250
4251export default { TipsDialog, ConfirmDialog, SelectDialog, AlertDialog, LoadingDialog, CustomContentDialog, PopoverDialog };