1/*
2 * Copyright (c) 2023 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 */
15if (!("finalizeConstruction" in ViewPU.prototype)) {
16    Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
17}
18const LengthMetrics = requireNapi('arkui.node').LengthMetrics;
19
20export var CounterType;
21(function (j21) {
22    j21[j21["LIST"] = 0] = "LIST";
23    j21[j21["COMPACT"] = 1] = "COMPACT";
24    j21[j21["INLINE"] = 2] = "INLINE";
25    j21[j21["INLINE_DATE"] = 3] = "INLINE_DATE";
26})(CounterType || (CounterType = {}));
27var FocusText;
28(function (i21) {
29    i21[i21["NONE"] = 0] = "NONE";
30    i21[i21["TEXT1"] = 1] = "TEXT1";
31    i21[i21["TEXT2"] = 2] = "TEXT2";
32    i21[i21["TEXT3"] = 3] = "TEXT3";
33})(FocusText || (FocusText = {}));
34
35export class CommonOptions {
36}
37
38export class InlineStyleOptions extends CommonOptions {
39}
40
41export class NumberStyleOptions extends InlineStyleOptions {
42}
43
44export class DateData {
45    constructor(f21, g21, h21) {
46        this.year = f21;
47        this.month = g21;
48        this.day = h21;
49    }
50
51    toString() {
52        let c21 = this.year.toString() + '-';
53        let d21 = this.month < 10 ? '0' + this.month.toString() : this.month.toString();
54        c21 += d21 + '-';
55        let e21 = this.day < 10 ? '0' + this.day.toString() : this.day.toString();
56        c21 += e21;
57        return c21;
58    }
59}
60
61export class DateStyleOptions extends CommonOptions {
62}
63
64export class CounterOptions {
65}
66
67class CounterResource {
68}
69
70CounterResource.BUTTON_BACKGROUD_COLOR = {
71    "id": -1,
72    "type": 10001,
73    params: ['sys.color.ohos_id_color_button_normal'],
74    "bundleName": "__harDefaultBundleName__",
75    "moduleName": "__harDefaultModuleName__"
76};
77CounterResource.BUTTON_ICON_COLOR = {
78    "id": -1,
79    "type": 10001,
80    params: ['sys.color.ohos_id_color_primary'],
81    "bundleName": "__harDefaultBundleName__",
82    "moduleName": "__harDefaultModuleName__"
83};
84CounterResource.BUTTON_BORDER_FOCUSED_COLOR = {
85    "id": -1,
86    "type": 10001,
87    params: ['sys.color.ohos_id_color_focused_outline'],
88    "bundleName": "__harDefaultBundleName__",
89    "moduleName": "__harDefaultModuleName__"
90};
91CounterResource.COUNTER_TEXT_COLOR = {
92    "id": -1,
93    "type": 10001,
94    params: ['sys.color.ohos_id_color_text_primary'],
95    "bundleName": "__harDefaultBundleName__",
96    "moduleName": "__harDefaultModuleName__"
97};
98CounterResource.COUNTER_BORDER_COLOR = {
99    "id": -1,
100    "type": 10001,
101    params: ['sys.color.ohos_id_color_component_normal'],
102    "bundleName": "__harDefaultBundleName__",
103    "moduleName": "__harDefaultModuleName__"
104};
105CounterResource.BUTTON_ADD_ICON = {
106    "id": -1,
107    "type": 20000,
108    params: ["sys.media.ohos_ic_public_add"],
109    "bundleName": "__harDefaultBundleName__",
110    "moduleName": "__harDefaultModuleName__"
111};
112CounterResource.BUTTON_SUB_ICON = {
113    "id": -1,
114    "type": 20000,
115    params: ["sys.media.ohos_ic_public_minus"],
116    "bundleName": "__harDefaultBundleName__",
117    "moduleName": "__harDefaultModuleName__"
118};
119CounterResource.BUTTON_ARROW_UP = {
120    "id": -1,
121    "type": 20000,
122    params: ['sys.media.ohos_ic_public_arrow_up'],
123    "bundleName": "__harDefaultBundleName__",
124    "moduleName": "__harDefaultModuleName__"
125};
126CounterResource.BUTTON_ARROW_DOWN = {
127    "id": -1,
128    "type": 20000,
129    params: ['sys.media.ohos_ic_public_arrow_down'],
130    "bundleName": "__harDefaultBundleName__",
131    "moduleName": "__harDefaultModuleName__"
132};
133CounterResource.BUTTON_BORDER_FOCUSED_WIDTH = '2vp';
134CounterResource.BUTTON_BORDER_BLUR_WIDTH = '0vp';
135CounterResource.COUNTER_BORDER_WIDTH = '1vp';
136CounterResource.COUNTER_BORDER_WIDTH_NUMBER = 1;
137CounterResource.COUNTER_LIST_LABEL_SIZE = {
138    "id": -1,
139    "type": 10002,
140    params: ['sys.float.ohos_id_text_size_body1'],
141    "bundleName": "__harDefaultBundleName__",
142    "moduleName": "__harDefaultModuleName__"
143};
144CounterResource.COUNTER_LIST_NUMBER_SIZE = {
145    "id": -1,
146    "type": 10002,
147    params: ['sys.float.ohos_id_text_size_body1'],
148    "bundleName": "__harDefaultBundleName__",
149    "moduleName": "__harDefaultModuleName__"
150};
151CounterResource.COUNTER_COMPACT_LABEL_SIZE = {
152    "id": -1,
153    "type": 10002,
154    params: ['sys.float.ohos_id_text_size_body2'],
155    "bundleName": "__harDefaultBundleName__",
156    "moduleName": "__harDefaultModuleName__"
157};
158CounterResource.COUNTER_NUMBER_SIZE = {
159    "id": -1,
160    "type": 10002,
161    params: ['sys.float.ohos_id_text_size_body1'],
162    "bundleName": "__harDefaultBundleName__",
163    "moduleName": "__harDefaultModuleName__"
164};
165CounterResource.COUNTER_LIST_LEFT_PADDING = {
166    "id": -1,
167    "type": 10002,
168    params: ['sys.float.ohos_id_default_padding_start'],
169    "bundleName": "__harDefaultBundleName__",
170    "moduleName": "__harDefaultModuleName__"
171};
172CounterResource.COUNTER_LIST_RIGHT_PADDING = {
173    "id": -1,
174    "type": 10002,
175    params: ['sys.float.ohos_id_default_padding_end'],
176    "bundleName": "__harDefaultBundleName__",
177    "moduleName": "__harDefaultModuleName__"
178};
179CounterResource.COUNTER_LIST_PADDING = 12;
180CounterResource.COUNTER_LIST_HEIGHT = '48vp';
181CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE = '20vp';
182CounterResource.COUNTER_LIST_BUTTON_SIZE = '32vp';
183CounterResource.COUNTER_LIST_BUTTON_RADIUS = '16vp';
184CounterResource.COUNTER_LIST_BUTTON_TEXT_DISTANCE = '8vp';
185CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN = 8;
186CounterResource.COUNTER_LIST_FOCUS_BORDER_SIZE = '30vp';
187CounterResource.COUNTER_LIST_FOCUS_BORDER_RADIUS = '15vp';
188CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_X = '-8vp';
189CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_Y = '-8vp';
190CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE = '16vp';
191CounterResource.COUNTER_COMPACT_BUTTON_SIZE = '24vp';
192CounterResource.COUNTER_COMPACT_BUTTON_RADIUS = '12vp';
193CounterResource.COUNTER_COMPACT_BUTTON_TEXT_DISTANCE = '10vp';
194CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN = 10;
195CounterResource.COUNTER_COMPACT_CONTAINER_HEIGHT = '28vp';
196CounterResource.COUNTER_COMPACT_CONTAINER_RADIUS = '14vp';
197CounterResource.COUNTER_COMPACT_CONTAINER_LABEL_DISTANCE = '8vp';
198CounterResource.COUNTER_COMPACT_FOCUS_BORDER_SIZE = '22vp';
199CounterResource.COUNTER_COMPACT_FOCUS_BORDER_RADIUS = '11vp';
200CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH = '24vp';
201CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT = '12vp';
202CounterResource.COUNTER_INLINE_BUTTON_TEXT_DISTANCE = '12vp';
203CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT = '32vp';
204CounterResource.COUNTER_INLINE_BUTTON_WIDTH = '32vp';
205CounterResource.COUNTER_INLINE_BUTTON_HEIGHT = '16vp';
206CounterResource.COUNTER_INLINE_RADIUS = '8vp';
207CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH = '28vp';
208CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT = '13.5vp';
209CounterResource.COUNTER_INLINE_DATE_TEXT_MARGIN = 12;
210CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN = 12;
211CounterResource.COUNTER_BUTTON_INITIAL_OPACITY = 1;
212CounterResource.COUNTER_BUTTON_DISABLE_OPACITY = 0.4;
213CounterResource.COUNTER_LABEL_MAX_FONT_SIZE_SCALE = 2;
214CounterResource.COUNTER_NUMBER_MAX_FONT_SIZE_SCALE = 1;
215
216class CounterConstant {
217}
218
219CounterConstant.COUNTER_MAX_YEAR = 5000;
220CounterConstant.COUNTER_MIN_YEAR = 1;
221CounterConstant.COUNTER_INITIAL_MONTH = 1;
222CounterConstant.COUNTER_INITIAL_DAY = 1;
223CounterConstant.COUNTER_INITIAL_STEP = 1;
224CounterConstant.COUNTER_TEN_NUMBER = 10;
225CounterConstant.COUNTER_MIN_MONTH = 1;
226CounterConstant.COUNTER_MAX_MONTH = 12;
227CounterConstant.COUNTER_MIN_DAY = 1;
228CounterConstant.KEYCODE_DPAD_UP = 2012;
229CounterConstant.KEYCODE_DPAD_DOWN = 2013;
230CounterConstant.KEYCODE_DPAD_LEFT = 2014;
231CounterConstant.KEYCODE_DPAD_RIGHT = 2015;
232CounterConstant.KEYCODE_MOVE_HOME = 2081;
233CounterConstant.KEYCODE_MOVE_END = 2082;
234CounterConstant.KEYCODE_TAB = 2049;
235CounterConstant.KEYCODE_ESC = 2070;
236CounterConstant.COUNTER_MIN_VALUE = 0;
237CounterConstant.COUNTER_MAX_VALUE = 999;
238CounterConstant.JANUARY = 1;
239CounterConstant.FEBRUARY = 2;
240CounterConstant.MARCH = 3;
241CounterConstant.APRIL = 4;
242CounterConstant.MAY = 5;
243CounterConstant.JUNE = 6;
244CounterConstant.JULY = 7;
245CounterConstant.AUGUST = 8;
246CounterConstant.SEPTEMBER = 9;
247CounterConstant.OCTOBER = 10;
248CounterConstant.NOVEMBER = 11;
249CounterConstant.DECEMBER = 12;
250CounterConstant.BIG_MONTH_DAYS = 31;
251CounterConstant.SMALL_MONTH_DAYS = 30;
252CounterConstant.FEBRUARY_DAYS = 28;
253CounterConstant.AUSPICIOUS_FEBRUARY_DAYS = 29;
254CounterConstant.AUSPICIOUS_FOUR = 4;
255CounterConstant.AUSPICIOUS_HUNDRED = 100;
256CounterConstant.AUSPICIOUS_FOUR_HUNDRED = 400;
257
258export class CounterComponent extends ViewPU {
259    constructor(w20, x20, y20, z20 = -1, a21 = undefined, b21) {
260        super(w20, y20, z20, b21);
261        if (typeof a21 === "function") {
262            this.paramsGenerator_ = a21;
263        }
264        this.__options = new SynchedPropertyObjectOneWayPU(x20.options, this, "options");
265        this.__type = new ObservedPropertySimplePU(-1, this, "type");
266        this.__counterDirection = new ObservedPropertySimplePU(Direction.Auto, this, "counterDirection");
267        this.__choverEffect = new ObservedPropertySimplePU(HoverEffect.Auto, this, "choverEffect");
268        this.__focusEnable = new ObservedPropertySimplePU(true, this, "focusEnable");
269        this.__step = new ObservedPropertySimplePU(CounterConstant.COUNTER_INITIAL_STEP, this, "step");
270        this.__inputValue = new ObservedPropertySimplePU('0', this, "inputValue");
271        this.__inputYear = new ObservedPropertySimplePU(CounterConstant.COUNTER_MIN_YEAR, this, "inputYear");
272        this.__inputMoon = new ObservedPropertySimplePU(0, this, "inputMoon");
273        this.__inputDay = new ObservedPropertySimplePU(0, this, "inputDay");
274        this.__inputHour = new ObservedPropertySimplePU(0, this, "inputHour");
275        this.__inputMinute = new ObservedPropertySimplePU(0, this, "inputMinute");
276        this.__inputSecond = new ObservedPropertySimplePU(0, this, "inputSecond");
277        this.__subOpacity = new ObservedPropertySimplePU(CounterResource.COUNTER_BUTTON_INITIAL_OPACITY, this, "subOpacity");
278        this.__addOpacity = new ObservedPropertySimplePU(CounterResource.COUNTER_BUTTON_INITIAL_OPACITY, this, "addOpacity");
279        this.__subBtnStateEffect = new ObservedPropertySimplePU(true, this, "subBtnStateEffect");
280        this.__addBtnStateEffect = new ObservedPropertySimplePU(true, this, "addBtnStateEffect");
281        this.__focusText = new ObservedPropertySimplePU(FocusText.NONE, this, "focusText");
282        this.__hasFocusText1 = new ObservedPropertySimplePU(false, this, "hasFocusText1");
283        this.__hasFocusText2 = new ObservedPropertySimplePU(false, this, "hasFocusText2");
284        this.__hasFocusText3 = new ObservedPropertySimplePU(false, this, "hasFocusText3");
285        this.__subBtnFocusWidh = new ObservedPropertySimplePU('0vp', this, "subBtnFocusWidh");
286        this.__addBtnFocusWidh = new ObservedPropertySimplePU('0vp', this, "addBtnFocusWidh");
287        this.__value = new ObservedPropertyObjectPU(undefined, this, "value");
288        this.__year = new ObservedPropertySimplePU(0, this, "year");
289        this.__month = new ObservedPropertySimplePU(0, this, "month");
290        this.__day = new ObservedPropertySimplePU(0, this, "day");
291        this.__hour = new ObservedPropertySimplePU(0, this, "hour");
292        this.__minute = new ObservedPropertySimplePU(0, this, "minute");
293        this.__second = new ObservedPropertySimplePU(0, this, "second");
294        this.__subBtnEnabled = new ObservedPropertySimplePU(true, this, "subBtnEnabled");
295        this.__addBtnEnabled = new ObservedPropertySimplePU(true, this, "addBtnEnabled");
296        this.__hasInputText1 = new ObservedPropertySimplePU(false, this, "hasInputText1");
297        this.__hasInputText2 = new ObservedPropertySimplePU(false, this, "hasInputText2");
298        this.__hasInputText3 = new ObservedPropertySimplePU(false, this, "hasInputText3");
299        this.__textWidth = new ObservedPropertySimplePU(0, this, "textWidth");
300        this.__min = new ObservedPropertySimplePU(CounterConstant.COUNTER_MIN_VALUE, this, "min");
301        this.__max = new ObservedPropertySimplePU(CounterConstant.COUNTER_MAX_VALUE, this, "max");
302        this.maxYear = CounterConstant.COUNTER_MAX_YEAR;
303        this.minYear = CounterConstant.COUNTER_MIN_YEAR;
304        this.numberStrList = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09'];
305        this.onHoverIncrease = undefined;
306        this.onHoverDecrease = undefined;
307        this.onFocusIncrease = undefined;
308        this.onFocusDecrease = undefined;
309        this.onBlurIncrease = undefined;
310        this.onBlurDecrease = undefined;
311        this.onChange = undefined;
312        this.onDateChange = undefined;
313        this.timeoutID1 = -1;
314        this.timeoutID2 = -1;
315        this.timeoutID3 = -1;
316        this.numberStyleOptions = undefined;
317        this.dateStyleOptions = undefined;
318        this.inlineStyleOptions = undefined;
319        this.timeStamp = 0;
320        this.hasTextWidth = false;
321        this.controller1 = new TextInputController();
322        this.controller2 = new TextInputController();
323        this.controller3 = new TextInputController();
324        this.setInitiallyProvidedValue(x20);
325        this.declareWatch("options", this.onOptionsChange);
326        this.finalizeConstruction();
327    }
328
329    setInitiallyProvidedValue(v20) {
330        if (v20.type !== undefined) {
331            this.type = v20.type;
332        }
333        if (v20.counterDirection !== undefined) {
334            this.counterDirection = v20.counterDirection;
335        }
336        if (v20.choverEffect !== undefined) {
337            this.choverEffect = v20.choverEffect;
338        }
339        if (v20.focusEnable !== undefined) {
340            this.focusEnable = v20.focusEnable;
341        }
342        if (v20.step !== undefined) {
343            this.step = v20.step;
344        }
345        if (v20.inputValue !== undefined) {
346            this.inputValue = v20.inputValue;
347        }
348        if (v20.inputYear !== undefined) {
349            this.inputYear = v20.inputYear;
350        }
351        if (v20.inputMoon !== undefined) {
352            this.inputMoon = v20.inputMoon;
353        }
354        if (v20.inputDay !== undefined) {
355            this.inputDay = v20.inputDay;
356        }
357        if (v20.inputHour !== undefined) {
358            this.inputHour = v20.inputHour;
359        }
360        if (v20.inputMinute !== undefined) {
361            this.inputMinute = v20.inputMinute;
362        }
363        if (v20.inputSecond !== undefined) {
364            this.inputSecond = v20.inputSecond;
365        }
366        if (v20.subOpacity !== undefined) {
367            this.subOpacity = v20.subOpacity;
368        }
369        if (v20.addOpacity !== undefined) {
370            this.addOpacity = v20.addOpacity;
371        }
372        if (v20.subBtnStateEffect !== undefined) {
373            this.subBtnStateEffect = v20.subBtnStateEffect;
374        }
375        if (v20.addBtnStateEffect !== undefined) {
376            this.addBtnStateEffect = v20.addBtnStateEffect;
377        }
378        if (v20.focusText !== undefined) {
379            this.focusText = v20.focusText;
380        }
381        if (v20.hasFocusText1 !== undefined) {
382            this.hasFocusText1 = v20.hasFocusText1;
383        }
384        if (v20.hasFocusText2 !== undefined) {
385            this.hasFocusText2 = v20.hasFocusText2;
386        }
387        if (v20.hasFocusText3 !== undefined) {
388            this.hasFocusText3 = v20.hasFocusText3;
389        }
390        if (v20.subBtnFocusWidh !== undefined) {
391            this.subBtnFocusWidh = v20.subBtnFocusWidh;
392        }
393        if (v20.addBtnFocusWidh !== undefined) {
394            this.addBtnFocusWidh = v20.addBtnFocusWidh;
395        }
396        if (v20.value !== undefined) {
397            this.value = v20.value;
398        }
399        if (v20.year !== undefined) {
400            this.year = v20.year;
401        }
402        if (v20.month !== undefined) {
403            this.month = v20.month;
404        }
405        if (v20.day !== undefined) {
406            this.day = v20.day;
407        }
408        if (v20.hour !== undefined) {
409            this.hour = v20.hour;
410        }
411        if (v20.minute !== undefined) {
412            this.minute = v20.minute;
413        }
414        if (v20.second !== undefined) {
415            this.second = v20.second;
416        }
417        if (v20.subBtnEnabled !== undefined) {
418            this.subBtnEnabled = v20.subBtnEnabled;
419        }
420        if (v20.addBtnEnabled !== undefined) {
421            this.addBtnEnabled = v20.addBtnEnabled;
422        }
423        if (v20.hasInputText1 !== undefined) {
424            this.hasInputText1 = v20.hasInputText1;
425        }
426        if (v20.hasInputText2 !== undefined) {
427            this.hasInputText2 = v20.hasInputText2;
428        }
429        if (v20.hasInputText3 !== undefined) {
430            this.hasInputText3 = v20.hasInputText3;
431        }
432        if (v20.textWidth !== undefined) {
433            this.textWidth = v20.textWidth;
434        }
435        if (v20.min !== undefined) {
436            this.min = v20.min;
437        }
438        if (v20.max !== undefined) {
439            this.max = v20.max;
440        }
441        if (v20.maxYear !== undefined) {
442            this.maxYear = v20.maxYear;
443        }
444        if (v20.minYear !== undefined) {
445            this.minYear = v20.minYear;
446        }
447        if (v20.numberStrList !== undefined) {
448            this.numberStrList = v20.numberStrList;
449        }
450        if (v20.onHoverIncrease !== undefined) {
451            this.onHoverIncrease = v20.onHoverIncrease;
452        }
453        if (v20.onHoverDecrease !== undefined) {
454            this.onHoverDecrease = v20.onHoverDecrease;
455        }
456        if (v20.onFocusIncrease !== undefined) {
457            this.onFocusIncrease = v20.onFocusIncrease;
458        }
459        if (v20.onFocusDecrease !== undefined) {
460            this.onFocusDecrease = v20.onFocusDecrease;
461        }
462        if (v20.onBlurIncrease !== undefined) {
463            this.onBlurIncrease = v20.onBlurIncrease;
464        }
465        if (v20.onBlurDecrease !== undefined) {
466            this.onBlurDecrease = v20.onBlurDecrease;
467        }
468        if (v20.onChange !== undefined) {
469            this.onChange = v20.onChange;
470        }
471        if (v20.onDateChange !== undefined) {
472            this.onDateChange = v20.onDateChange;
473        }
474        if (v20.timeoutID1 !== undefined) {
475            this.timeoutID1 = v20.timeoutID1;
476        }
477        if (v20.timeoutID2 !== undefined) {
478            this.timeoutID2 = v20.timeoutID2;
479        }
480        if (v20.timeoutID3 !== undefined) {
481            this.timeoutID3 = v20.timeoutID3;
482        }
483        if (v20.numberStyleOptions !== undefined) {
484            this.numberStyleOptions = v20.numberStyleOptions;
485        }
486        if (v20.dateStyleOptions !== undefined) {
487            this.dateStyleOptions = v20.dateStyleOptions;
488        }
489        if (v20.inlineStyleOptions !== undefined) {
490            this.inlineStyleOptions = v20.inlineStyleOptions;
491        }
492        if (v20.timeStamp !== undefined) {
493            this.timeStamp = v20.timeStamp;
494        }
495        if (v20.hasTextWidth !== undefined) {
496            this.hasTextWidth = v20.hasTextWidth;
497        }
498        if (v20.controller1 !== undefined) {
499            this.controller1 = v20.controller1;
500        }
501        if (v20.controller2 !== undefined) {
502            this.controller2 = v20.controller2;
503        }
504        if (v20.controller3 !== undefined) {
505            this.controller3 = v20.controller3;
506        }
507    }
508
509    updateStateVars(u20) {
510        this.__options.reset(u20.options);
511    }
512
513    purgeVariableDependenciesOnElmtId(t20) {
514        this.__options.purgeDependencyOnElmtId(t20);
515        this.__type.purgeDependencyOnElmtId(t20);
516        this.__counterDirection.purgeDependencyOnElmtId(t20);
517        this.__choverEffect.purgeDependencyOnElmtId(t20);
518        this.__focusEnable.purgeDependencyOnElmtId(t20);
519        this.__step.purgeDependencyOnElmtId(t20);
520        this.__inputValue.purgeDependencyOnElmtId(t20);
521        this.__inputYear.purgeDependencyOnElmtId(t20);
522        this.__inputMoon.purgeDependencyOnElmtId(t20);
523        this.__inputDay.purgeDependencyOnElmtId(t20);
524        this.__inputHour.purgeDependencyOnElmtId(t20);
525        this.__inputMinute.purgeDependencyOnElmtId(t20);
526        this.__inputSecond.purgeDependencyOnElmtId(t20);
527        this.__subOpacity.purgeDependencyOnElmtId(t20);
528        this.__addOpacity.purgeDependencyOnElmtId(t20);
529        this.__subBtnStateEffect.purgeDependencyOnElmtId(t20);
530        this.__addBtnStateEffect.purgeDependencyOnElmtId(t20);
531        this.__focusText.purgeDependencyOnElmtId(t20);
532        this.__hasFocusText1.purgeDependencyOnElmtId(t20);
533        this.__hasFocusText2.purgeDependencyOnElmtId(t20);
534        this.__hasFocusText3.purgeDependencyOnElmtId(t20);
535        this.__subBtnFocusWidh.purgeDependencyOnElmtId(t20);
536        this.__addBtnFocusWidh.purgeDependencyOnElmtId(t20);
537        this.__value.purgeDependencyOnElmtId(t20);
538        this.__year.purgeDependencyOnElmtId(t20);
539        this.__month.purgeDependencyOnElmtId(t20);
540        this.__day.purgeDependencyOnElmtId(t20);
541        this.__hour.purgeDependencyOnElmtId(t20);
542        this.__minute.purgeDependencyOnElmtId(t20);
543        this.__second.purgeDependencyOnElmtId(t20);
544        this.__subBtnEnabled.purgeDependencyOnElmtId(t20);
545        this.__addBtnEnabled.purgeDependencyOnElmtId(t20);
546        this.__hasInputText1.purgeDependencyOnElmtId(t20);
547        this.__hasInputText2.purgeDependencyOnElmtId(t20);
548        this.__hasInputText3.purgeDependencyOnElmtId(t20);
549        this.__textWidth.purgeDependencyOnElmtId(t20);
550        this.__min.purgeDependencyOnElmtId(t20);
551        this.__max.purgeDependencyOnElmtId(t20);
552    }
553
554    aboutToBeDeleted() {
555        this.__options.aboutToBeDeleted();
556        this.__type.aboutToBeDeleted();
557        this.__counterDirection.aboutToBeDeleted();
558        this.__choverEffect.aboutToBeDeleted();
559        this.__focusEnable.aboutToBeDeleted();
560        this.__step.aboutToBeDeleted();
561        this.__inputValue.aboutToBeDeleted();
562        this.__inputYear.aboutToBeDeleted();
563        this.__inputMoon.aboutToBeDeleted();
564        this.__inputDay.aboutToBeDeleted();
565        this.__inputHour.aboutToBeDeleted();
566        this.__inputMinute.aboutToBeDeleted();
567        this.__inputSecond.aboutToBeDeleted();
568        this.__subOpacity.aboutToBeDeleted();
569        this.__addOpacity.aboutToBeDeleted();
570        this.__subBtnStateEffect.aboutToBeDeleted();
571        this.__addBtnStateEffect.aboutToBeDeleted();
572        this.__focusText.aboutToBeDeleted();
573        this.__hasFocusText1.aboutToBeDeleted();
574        this.__hasFocusText2.aboutToBeDeleted();
575        this.__hasFocusText3.aboutToBeDeleted();
576        this.__subBtnFocusWidh.aboutToBeDeleted();
577        this.__addBtnFocusWidh.aboutToBeDeleted();
578        this.__value.aboutToBeDeleted();
579        this.__year.aboutToBeDeleted();
580        this.__month.aboutToBeDeleted();
581        this.__day.aboutToBeDeleted();
582        this.__hour.aboutToBeDeleted();
583        this.__minute.aboutToBeDeleted();
584        this.__second.aboutToBeDeleted();
585        this.__subBtnEnabled.aboutToBeDeleted();
586        this.__addBtnEnabled.aboutToBeDeleted();
587        this.__hasInputText1.aboutToBeDeleted();
588        this.__hasInputText2.aboutToBeDeleted();
589        this.__hasInputText3.aboutToBeDeleted();
590        this.__textWidth.aboutToBeDeleted();
591        this.__min.aboutToBeDeleted();
592        this.__max.aboutToBeDeleted();
593        SubscriberManager.Get().delete(this.id__());
594        this.aboutToBeDeletedInternal();
595    }
596
597    get options() {
598        return this.__options.get();
599    }
600
601    set options(s20) {
602        this.__options.set(s20);
603    }
604
605    get type() {
606        return this.__type.get();
607    }
608
609    set type(r20) {
610        this.__type.set(r20);
611    }
612
613    get counterDirection() {
614        return this.__counterDirection.get();
615    }
616
617    set counterDirection(q20) {
618        this.__counterDirection.set(q20);
619    }
620
621    get choverEffect() {
622        return this.__choverEffect.get();
623    }
624
625    set choverEffect(p20) {
626        this.__choverEffect.set(p20);
627    }
628
629    get focusEnable() {
630        return this.__focusEnable.get();
631    }
632
633    set focusEnable(o20) {
634        this.__focusEnable.set(o20);
635    }
636
637    get step() {
638        return this.__step.get();
639    }
640
641    set step(n20) {
642        this.__step.set(n20);
643    }
644
645    get inputValue() {
646        return this.__inputValue.get();
647    }
648
649    set inputValue(m20) {
650        this.__inputValue.set(m20);
651    }
652
653    get inputYear() {
654        return this.__inputYear.get();
655    }
656
657    set inputYear(l20) {
658        this.__inputYear.set(l20);
659    }
660
661    get inputMoon() {
662        return this.__inputMoon.get();
663    }
664
665    set inputMoon(k20) {
666        this.__inputMoon.set(k20);
667    }
668
669    get inputDay() {
670        return this.__inputDay.get();
671    }
672
673    set inputDay(j20) {
674        this.__inputDay.set(j20);
675    }
676
677    get inputHour() {
678        return this.__inputHour.get();
679    }
680
681    set inputHour(i20) {
682        this.__inputHour.set(i20);
683    }
684
685    get inputMinute() {
686        return this.__inputMinute.get();
687    }
688
689    set inputMinute(h20) {
690        this.__inputMinute.set(h20);
691    }
692
693    get inputSecond() {
694        return this.__inputSecond.get();
695    }
696
697    set inputSecond(g20) {
698        this.__inputSecond.set(g20);
699    }
700
701    get subOpacity() {
702        return this.__subOpacity.get();
703    }
704
705    set subOpacity(f20) {
706        this.__subOpacity.set(f20);
707    }
708
709    get addOpacity() {
710        return this.__addOpacity.get();
711    }
712
713    set addOpacity(e20) {
714        this.__addOpacity.set(e20);
715    }
716
717    get subBtnStateEffect() {
718        return this.__subBtnStateEffect.get();
719    }
720
721    set subBtnStateEffect(d20) {
722        this.__subBtnStateEffect.set(d20);
723    }
724
725    get addBtnStateEffect() {
726        return this.__addBtnStateEffect.get();
727    }
728
729    set addBtnStateEffect(c20) {
730        this.__addBtnStateEffect.set(c20);
731    }
732
733    get focusText() {
734        return this.__focusText.get();
735    }
736
737    set focusText(b20) {
738        this.__focusText.set(b20);
739    }
740
741    get hasFocusText1() {
742        return this.__hasFocusText1.get();
743    }
744
745    set hasFocusText1(a20) {
746        this.__hasFocusText1.set(a20);
747    }
748
749    get hasFocusText2() {
750        return this.__hasFocusText2.get();
751    }
752
753    set hasFocusText2(z19) {
754        this.__hasFocusText2.set(z19);
755    }
756
757    get hasFocusText3() {
758        return this.__hasFocusText3.get();
759    }
760
761    set hasFocusText3(y19) {
762        this.__hasFocusText3.set(y19);
763    }
764
765    get subBtnFocusWidh() {
766        return this.__subBtnFocusWidh.get();
767    }
768
769    set subBtnFocusWidh(x19) {
770        this.__subBtnFocusWidh.set(x19);
771    }
772
773    get addBtnFocusWidh() {
774        return this.__addBtnFocusWidh.get();
775    }
776
777    set addBtnFocusWidh(w19) {
778        this.__addBtnFocusWidh.set(w19);
779    }
780
781    get value() {
782        return this.__value.get();
783    }
784
785    set value(v19) {
786        this.__value.set(v19);
787    }
788
789    get year() {
790        return this.__year.get();
791    }
792
793    set year(u19) {
794        this.__year.set(u19);
795    }
796
797    get month() {
798        return this.__month.get();
799    }
800
801    set month(t19) {
802        this.__month.set(t19);
803    }
804
805    get day() {
806        return this.__day.get();
807    }
808
809    set day(s19) {
810        this.__day.set(s19);
811    }
812
813    get hour() {
814        return this.__hour.get();
815    }
816
817    set hour(r19) {
818        this.__hour.set(r19);
819    }
820
821    get minute() {
822        return this.__minute.get();
823    }
824
825    set minute(q19) {
826        this.__minute.set(q19);
827    }
828
829    get second() {
830        return this.__second.get();
831    }
832
833    set second(p19) {
834        this.__second.set(p19);
835    }
836
837    get subBtnEnabled() {
838        return this.__subBtnEnabled.get();
839    }
840
841    set subBtnEnabled(o19) {
842        this.__subBtnEnabled.set(o19);
843    }
844
845    get addBtnEnabled() {
846        return this.__addBtnEnabled.get();
847    }
848
849    set addBtnEnabled(n19) {
850        this.__addBtnEnabled.set(n19);
851    }
852
853    get hasInputText1() {
854        return this.__hasInputText1.get();
855    }
856
857    set hasInputText1(m19) {
858        this.__hasInputText1.set(m19);
859    }
860
861    get hasInputText2() {
862        return this.__hasInputText2.get();
863    }
864
865    set hasInputText2(l19) {
866        this.__hasInputText2.set(l19);
867    }
868
869    get hasInputText3() {
870        return this.__hasInputText3.get();
871    }
872
873    set hasInputText3(k19) {
874        this.__hasInputText3.set(k19);
875    }
876
877    get textWidth() {
878        return this.__textWidth.get();
879    }
880
881    set textWidth(j19) {
882        this.__textWidth.set(j19);
883    }
884
885    get min() {
886        return this.__min.get();
887    }
888
889    set min(i19) {
890        this.__min.set(i19);
891    }
892
893    get max() {
894        return this.__max.get();
895    }
896
897    set max(h19) {
898        this.__max.set(h19);
899    }
900
901    getTextInputFontSize() {
902        let fontSize = this.resourceToVp(CounterResource.COUNTER_NUMBER_SIZE);
903        let uiContext = this.getUIContext();
904        let fontSizeScale = uiContext.getHostContext()?.config?.fontSizeScale ?? 1;
905        if (fontSizeScale < 1) {
906            return fontSize + 'fp';
907        } else {
908            return fontSize + 'vp';
909        }
910    }
911
912    convertNumberToString(g19) {
913        if (g19 >= 0 && g19 < CounterConstant.COUNTER_TEN_NUMBER) {
914            return this.numberStrList[g19];
915        }
916        else {
917            return g19.toString();
918        }
919    }
920
921    aboutToAppear() {
922        let f19 = new Date();
923        this.timeStamp = f19.getTime();
924        if (this.options !== undefined && this.options !== null) {
925            this.onOptionsChange();
926        }
927    }
928
929    updateNumberStyleOptions() {
930        if (this.numberStyleOptions.label === undefined) {
931            this.numberStyleOptions.label = '';
932        }
933        if (this.value === undefined) {
934            this.value = this.numberStyleOptions.value !== undefined ? this.numberStyleOptions.value : 0;
935            this.onChange?.(this.value);
936            this.inputValue = this.value.toString();
937        }
938        if (this.numberStyleOptions.min !== undefined) {
939            this.min = this.numberStyleOptions.min;
940        }
941        if (this.numberStyleOptions.max !== undefined) {
942            this.max = this.numberStyleOptions.max;
943        }
944        if (this.min > this.max) {
945            this.min = this.max;
946        }
947        if (this.numberStyleOptions.textWidth !== undefined) {
948            this.textWidth = this.numberStyleOptions.textWidth;
949            if (this.textWidth < 0) {
950                this.textWidth = 0;
951            }
952            this.hasTextWidth = true;
953        }
954        if (this.value <= this.min) {
955            this.value = this.min;
956            this.onChange?.(this.value);
957            this.inputValue = this.value.toString();
958        }
959        if (this.value >= this.max) {
960            this.value = this.max;
961            this.onChange?.(this.value);
962            this.inputValue = this.value.toString();
963        }
964        if (this.numberStyleOptions.step !== undefined) {
965            if (this.numberStyleOptions.step < 1) {
966                this.step = 1;
967            }
968            else {
969                this.step = this.numberStyleOptions.step;
970            }
971        }
972        this.updateButtonStatus();
973        this.updateNumberStyleOptionsEvent();
974    }
975
976    updateNumberStyleOptionsEvent() {
977        if (this.numberStyleOptions.onHoverIncrease !== undefined) {
978            this.onHoverIncrease = this.numberStyleOptions.onHoverIncrease;
979        }
980        if (this.numberStyleOptions.onHoverDecrease !== undefined) {
981            this.onHoverDecrease = this.numberStyleOptions.onHoverDecrease;
982        }
983        if (this.numberStyleOptions.onFocusIncrease !== undefined) {
984            this.onFocusIncrease = this.numberStyleOptions.onFocusIncrease;
985        }
986        if (this.numberStyleOptions.onFocusDecrease !== undefined) {
987            this.onFocusDecrease = this.numberStyleOptions.onFocusDecrease;
988        }
989        if (this.numberStyleOptions.onBlurIncrease !== undefined) {
990            this.onBlurIncrease = this.numberStyleOptions.onBlurIncrease;
991        }
992        if (this.numberStyleOptions.onBlurDecrease !== undefined) {
993            this.onBlurDecrease = this.numberStyleOptions.onBlurDecrease;
994        }
995        if (this.numberStyleOptions.onChange !== undefined) {
996            this.onChange = this.numberStyleOptions.onChange;
997        }
998        if (this.numberStyleOptions.focusable !== undefined) {
999            this.focusEnable = this.numberStyleOptions.focusable;
1000        }
1001    }
1002
1003    updateInlineStyleOptions() {
1004        if (this.value === undefined) {
1005            this.value = this.inlineStyleOptions.value !== undefined ? this.inlineStyleOptions.value : 0;
1006            this.onChange?.(this.value);
1007            this.inputValue = this.value.toString();
1008        }
1009        if (this.inlineStyleOptions.min !== undefined) {
1010            this.min = this.inlineStyleOptions.min;
1011        }
1012        if (this.inlineStyleOptions.max !== undefined) {
1013            this.max = this.inlineStyleOptions.max;
1014        }
1015        if (this.min > this.max) {
1016            this.min = this.max;
1017        }
1018        if (this.inlineStyleOptions.textWidth !== undefined) {
1019            this.textWidth = this.inlineStyleOptions.textWidth;
1020            if (this.textWidth < 0) {
1021                this.textWidth = 0;
1022            }
1023            this.hasTextWidth = true;
1024        }
1025        if (this.value <= this.min) {
1026            this.value = this.min;
1027            this.onChange?.(this.value);
1028            this.inputValue = this.value.toString();
1029        }
1030        if (this.value >= this.max) {
1031            this.value = this.max;
1032            this.onChange?.(this.value);
1033            this.inputValue = this.value.toString();
1034        }
1035        if (this.inlineStyleOptions.step !== undefined) {
1036            if (this.inlineStyleOptions.step < 1) {
1037                this.step = 1;
1038            }
1039            else {
1040                this.step = this.inlineStyleOptions.step;
1041            }
1042        }
1043        this.updateButtonStatus();
1044        this.updateInlineStyleOptionsEvent();
1045    }
1046
1047    updateInlineStyleOptionsEvent() {
1048        if (this.inlineStyleOptions.onHoverIncrease !== undefined) {
1049            this.onHoverIncrease = this.inlineStyleOptions.onHoverIncrease;
1050        }
1051        if (this.inlineStyleOptions.onHoverDecrease !== undefined) {
1052            this.onHoverDecrease = this.inlineStyleOptions.onHoverDecrease;
1053        }
1054        if (this.inlineStyleOptions.onChange !== undefined) {
1055            this.onChange = this.inlineStyleOptions.onChange;
1056        }
1057        if (this.inlineStyleOptions.focusable !== undefined) {
1058            this.focusEnable = this.inlineStyleOptions.focusable;
1059        }
1060    }
1061
1062    updateDateStyleOptions() {
1063        if (this.dateStyleOptions.step !== undefined) {
1064            if (this.dateStyleOptions.step < 1) {
1065                this.step = 1;
1066            }
1067            else {
1068                this.step = Math.floor(this.dateStyleOptions.step);
1069            }
1070        }
1071        if (this.dateStyleOptions.onHoverIncrease !== undefined) {
1072            this.onHoverIncrease = this.dateStyleOptions.onHoverIncrease;
1073        }
1074        if (this.dateStyleOptions.onHoverDecrease !== undefined) {
1075            this.onHoverDecrease = this.dateStyleOptions.onHoverDecrease;
1076        }
1077        if (this.dateStyleOptions.year !== undefined &&
1078            this.dateStyleOptions.year >= this.minYear &&
1079            this.dateStyleOptions.year <= this.maxYear) {
1080            if (this.year === 0) {
1081                this.year = this.dateStyleOptions.year;
1082            }
1083        }
1084        else {
1085            this.year = CounterConstant.COUNTER_MIN_YEAR;
1086        }
1087        if (this.dateStyleOptions.month !== undefined &&
1088            this.dateStyleOptions.month <= CounterConstant.COUNTER_MAX_MONTH &&
1089            this.dateStyleOptions.month >= CounterConstant.COUNTER_MIN_MONTH) {
1090            if (this.month === 0) {
1091                this.month = this.dateStyleOptions.month;
1092            }
1093        }
1094        else {
1095            this.month = CounterConstant.COUNTER_INITIAL_MONTH;
1096        }
1097        if (this.dateStyleOptions.day !== undefined &&
1098            this.dateStyleOptions.day <= this.getDayNumber() &&
1099            this.dateStyleOptions.day >= CounterConstant.COUNTER_MIN_DAY) {
1100            if (this.day === 0) {
1101                this.day = this.dateStyleOptions.day;
1102            }
1103        }
1104        else {
1105            this.day = CounterConstant.COUNTER_INITIAL_DAY;
1106        }
1107        if (this.dateStyleOptions.onDateChange !== undefined) {
1108            this.onDateChange = this.dateStyleOptions.onDateChange;
1109        }
1110        if (this.dateStyleOptions.focusable !== undefined) {
1111            this.focusEnable = this.dateStyleOptions.focusable;
1112        }
1113        this.updateDay();
1114    }
1115
1116    onOptionsChange() {
1117        this.type = this.options.type;
1118        if (this.options.direction) {
1119            this.counterDirection = this.options.direction;
1120        }
1121        else {
1122            this.counterDirection = Direction.Auto;
1123        }
1124        if (this.type === CounterType.LIST ||
1125            this.type === CounterType.COMPACT) {
1126            this.numberStyleOptions = this.options.numberOptions;
1127            this.updateNumberStyleOptions();
1128        }
1129        else if (this.type === CounterType.INLINE) {
1130            this.inlineStyleOptions = this.options.inlineOptions;
1131            this.updateInlineStyleOptions();
1132        }
1133        else if (this.type === CounterType.INLINE_DATE) {
1134            let y18 = this.options.dateOptions;
1135            y18.year = y18.year ? y18.year : CounterConstant.COUNTER_MIN_YEAR;
1136            y18.month = y18.month ? y18.month : CounterConstant.COUNTER_MIN_MONTH;
1137            y18.day = y18.day ? y18.day : CounterConstant.COUNTER_MIN_DAY;
1138            this.dateStyleOptions = y18;
1139            this.updateDateStyleOptions();
1140        }
1141        else {
1142        }
1143    }
1144
1145    subValue() {
1146        if (this.subBtnStateEffect) {
1147            this.value -= this.step;
1148        }
1149        if (!this.addBtnStateEffect) {
1150            this.addBtnStateEffect = true;
1151            this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1152            this.addBtnEnabled = true;
1153        }
1154        if (this.value <= this.min) {
1155            this.value = this.min;
1156            this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1157            this.subBtnStateEffect = false;
1158            this.subBtnEnabled = false;
1159        }
1160        else {
1161            if (this.subOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) {
1162                this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1163            }
1164            if (!this.subBtnStateEffect) {
1165                this.subBtnStateEffect = true;
1166            }
1167            if (!this.subBtnEnabled) {
1168                this.subBtnEnabled = true;
1169            }
1170        }
1171        this.focusText1();
1172    }
1173
1174    focusText1() {
1175        if (this.type === CounterType.INLINE) {
1176            if (this.focusText === FocusText.NONE) {
1177                this.focusText = FocusText.TEXT1;
1178                this.hasFocusText1 = true;
1179                this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
1180            }
1181        }
1182    }
1183
1184    addValue() {
1185        if (this.addBtnStateEffect) {
1186            this.value += this.step;
1187        }
1188        if (!this.subBtnStateEffect) {
1189            this.subBtnStateEffect = true;
1190            this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1191            this.subBtnEnabled = true;
1192        }
1193        if (this.value >= this.max) {
1194            this.value = this.max;
1195            this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1196            this.addBtnStateEffect = false;
1197            this.addBtnEnabled = false;
1198        }
1199        else {
1200            if (this.addOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) {
1201                this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1202            }
1203            if (!this.addBtnStateEffect) {
1204                this.addBtnStateEffect = true;
1205            }
1206            if (!this.addBtnEnabled) {
1207                this.addBtnEnabled = true;
1208            }
1209        }
1210        this.focusText1();
1211    }
1212
1213    getDayNumber() {
1214        switch (this.month) {
1215            case CounterConstant.JANUARY:
1216            case CounterConstant.MARCH:
1217            case CounterConstant.MAY:
1218            case CounterConstant.JULY:
1219            case CounterConstant.AUGUST:
1220            case CounterConstant.OCTOBER:
1221            case CounterConstant.DECEMBER:
1222                return CounterConstant.BIG_MONTH_DAYS;
1223                break;
1224            case CounterConstant.APRIL:
1225            case CounterConstant.JUNE:
1226            case CounterConstant.SEPTEMBER:
1227            case CounterConstant.NOVEMBER:
1228                return CounterConstant.SMALL_MONTH_DAYS;
1229                break;
1230            case CounterConstant.FEBRUARY:
1231                if ((this.year % CounterConstant.AUSPICIOUS_FOUR === 0 &&
1232                    this.year % CounterConstant.AUSPICIOUS_HUNDRED !== 0) ||
1233                    this.year % CounterConstant.AUSPICIOUS_FOUR_HUNDRED === 0) {
1234                    return CounterConstant.AUSPICIOUS_FEBRUARY_DAYS;
1235                }
1236                else {
1237                    return CounterConstant.FEBRUARY_DAYS;
1238                }
1239                break;
1240            default:
1241                break;
1242        }
1243    }
1244
1245    subDate() {
1246        if (this.focusText === FocusText.TEXT1) {
1247            if (this.subBtnStateEffect) {
1248                this.inputYear = this.year;
1249                this.year -= this.step;
1250                if (!this.hasFocusText1) {
1251                    this.hasFocusText1 = true;
1252                }
1253            }
1254            if (!this.addBtnStateEffect) {
1255                this.addBtnStateEffect = true;
1256                this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1257                this.addBtnEnabled = true;
1258            }
1259            if (this.year <= this.minYear) {
1260                this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1261                this.subBtnStateEffect = false;
1262                this.subBtnEnabled = false;
1263            }
1264            else {
1265                if (this.subOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) {
1266                    this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1267                }
1268                if (!this.subBtnStateEffect) {
1269                    this.subBtnStateEffect = true;
1270                }
1271                if (!this.subBtnEnabled) {
1272                    this.subBtnEnabled = true;
1273                }
1274            }
1275        }
1276        else if (this.focusText === FocusText.TEXT2) {
1277            this.month -= this.step % CounterConstant.COUNTER_MAX_MONTH;
1278            if (this.month < CounterConstant.COUNTER_MIN_MONTH) {
1279                this.month += CounterConstant.COUNTER_MAX_MONTH;
1280            }
1281            if (!this.hasFocusText2) {
1282                this.hasFocusText2 = true;
1283            }
1284        }
1285        else if (this.focusText === FocusText.TEXT3) {
1286            this.day -= this.step % this.getDayNumber();
1287            if (this.day < CounterConstant.COUNTER_MIN_DAY) {
1288                this.day += this.getDayNumber();
1289            }
1290            if (!this.hasFocusText3) {
1291                this.hasFocusText3 = true;
1292            }
1293        }
1294        else {
1295            this.focusDayWitdhSub();
1296        }
1297    }
1298
1299    focusDayWitdhSub() {
1300        this.focusText = FocusText.TEXT3;
1301        this.hasFocusText3 = true;
1302        this.day -= this.step % this.getDayNumber();
1303        if (this.day < CounterConstant.COUNTER_MIN_DAY) {
1304            this.day += this.getDayNumber();
1305        }
1306        this.focusWithTarget('DateTextInput3' + this.timeStamp.toString());
1307    }
1308
1309    addDate() {
1310        if (this.focusText === FocusText.TEXT1) {
1311            if (this.addBtnStateEffect) {
1312                this.inputYear = this.year;
1313                this.year += this.step;
1314                if (!this.hasFocusText1) {
1315                    this.hasFocusText1 = true;
1316                }
1317            }
1318            if (!this.subBtnStateEffect) {
1319                this.subBtnStateEffect = true;
1320                this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1321                this.subBtnEnabled = true;
1322            }
1323            if (this.year >= this.maxYear) {
1324                this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1325                this.addBtnStateEffect = false;
1326                this.addBtnEnabled = false;
1327            }
1328            else {
1329                if (this.addOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) {
1330                    this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1331                }
1332                if (!this.addBtnStateEffect) {
1333                    this.addBtnStateEffect = true;
1334                }
1335                if (!this.addBtnEnabled) {
1336                    this.addBtnEnabled = true;
1337                }
1338            }
1339        }
1340        else if (this.focusText === FocusText.TEXT2) {
1341            this.month += this.step % CounterConstant.COUNTER_MAX_MONTH;
1342            if (this.month > CounterConstant.COUNTER_MAX_MONTH) {
1343                this.month -= CounterConstant.COUNTER_MAX_MONTH;
1344            }
1345            if (!this.hasFocusText2) {
1346                this.hasFocusText2 = true;
1347            }
1348        }
1349        else if (this.focusText === FocusText.TEXT3) {
1350            this.day += this.step % this.getDayNumber();
1351            if (this.day > this.getDayNumber()) {
1352                this.day -= this.getDayNumber();
1353            }
1354            if (!this.hasFocusText3) {
1355                this.hasFocusText3 = true;
1356            }
1357        }
1358        else {
1359            this.focusDayWithAdd();
1360        }
1361    }
1362
1363    focusDayWithAdd() {
1364        this.focusText = FocusText.TEXT3;
1365        this.hasFocusText3 = true;
1366        this.day += this.step % this.getDayNumber();
1367        if (this.day > this.getDayNumber()) {
1368            this.day -= this.getDayNumber();
1369        }
1370        this.focusWithTarget('DateTextInput3' + this.timeStamp.toString());
1371    }
1372
1373    updateInlineEnableSate() {
1374        if (this.value >= this.max) {
1375            this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1376            this.addBtnStateEffect = false;
1377            this.addBtnEnabled = false;
1378        }
1379        else {
1380            this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1381            this.addBtnStateEffect = true;
1382            this.addBtnEnabled = true;
1383        }
1384        if (this.value <= this.min) {
1385            this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1386            this.subBtnStateEffect = false;
1387            this.subBtnEnabled = false;
1388        }
1389        else {
1390            this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1391            this.subBtnStateEffect = true;
1392            this.subBtnEnabled = true;
1393        }
1394    }
1395
1396    updateDateEnableSate() {
1397        if (this.year === this.maxYear && this.focusText === FocusText.TEXT1) {
1398            this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1399            this.addBtnStateEffect = false;
1400            this.addBtnEnabled = false;
1401        }
1402        else {
1403            if (this.addOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) {
1404                this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1405            }
1406            if (!this.addBtnStateEffect) {
1407                this.addBtnStateEffect = true;
1408            }
1409            if (!this.addBtnEnabled) {
1410                this.addBtnEnabled = true;
1411            }
1412        }
1413        if (this.year === this.minYear && this.focusText === FocusText.TEXT1) {
1414            this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1415            this.subBtnStateEffect = false;
1416            this.subBtnEnabled = false;
1417        }
1418        else {
1419            if (this.subOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) {
1420                this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1421            }
1422            if (!this.subBtnStateEffect) {
1423                this.subBtnStateEffect = true;
1424            }
1425            if (!this.subBtnEnabled) {
1426                this.subBtnEnabled = true;
1427            }
1428        }
1429    }
1430
1431    updateDay() {
1432        if (this.day > this.getDayNumber()) {
1433            this.day = this.getDayNumber();
1434        }
1435    }
1436
1437    resetFocusText() {
1438        this.focusText = FocusText.NONE;
1439        this.hasFocusText1 = false;
1440        this.hasFocusText2 = false;
1441        this.hasFocusText3 = false;
1442    }
1443
1444    resetFocusButton() {
1445        if (this.addBtnFocusWidh === CounterResource.BUTTON_BORDER_FOCUSED_WIDTH) {
1446            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1447            this.onBlurIncrease && this.onBlurIncrease();
1448        }
1449        if (this.subBtnFocusWidh === CounterResource.BUTTON_BORDER_FOCUSED_WIDTH) {
1450            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1451            this.onBlurDecrease && this.onBlurDecrease();
1452        }
1453    }
1454
1455    homeFocusText() {
1456        this.focusWithTarget('DateTextInput1' + this.timeStamp.toString());
1457    }
1458
1459    endFocusText() {
1460        this.focusWithTarget('DateTextInput3' + this.timeStamp.toString());
1461    }
1462
1463    homeFirstValue() {
1464        this.value = this.min;
1465        if (!this.addBtnStateEffect) {
1466            this.addBtnStateEffect = true;
1467            this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1468            this.addBtnEnabled = true;
1469        }
1470    }
1471
1472    endLastValue() {
1473        this.value = this.max;
1474        if (!this.subBtnStateEffect) {
1475            this.subBtnStateEffect = true;
1476            this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1477            this.subBtnEnabled = true;
1478        }
1479    }
1480
1481    updateButtonStatus() {
1482        if (this.value <= this.min) {
1483            if (!this.addBtnStateEffect && this.max != this.min) {
1484                this.addBtnStateEffect = true;
1485                this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1486                this.addBtnEnabled = true;
1487            }
1488            this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1489            this.subBtnStateEffect = false;
1490            this.subBtnEnabled = false;
1491        }
1492        if (this.value >= this.max) {
1493            if (!this.subBtnStateEffect && this.max != this.min) {
1494                this.subBtnStateEffect = true;
1495                this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY;
1496                this.subBtnEnabled = true;
1497            }
1498            this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1499            this.addBtnStateEffect = false;
1500            this.addBtnEnabled = false;
1501        }
1502    }
1503
1504    getValue() {
1505        if (this.inputValue == undefined) {
1506            this.inputValue = '';
1507        }
1508        return this.hasInputText1 ? this.inputValue : this.value.toString();
1509    }
1510
1511    getValueLength() {
1512        return this.getValue().length > 0 ? this.getValue().length : 1;
1513    }
1514
1515    getYear() {
1516        let x18 = this.year.toString();
1517        if (x18.length === 1) {
1518            x18 = '000' + x18;
1519        }
1520        else if (x18.length === 2) {
1521            x18 = '00' + x18;
1522        }
1523        else if (x18.length === 3) {
1524            x18 = '0' + x18;
1525        }
1526        else {
1527            x18 = x18;
1528        }
1529        return x18;
1530    }
1531
1532    focusWithTarget(u18) {
1533        setTimeout(() => {
1534            var w18 = focusControl.requestFocus(u18);
1535            if (w18) {
1536                console.log('Request success');
1537            }
1538            else {
1539                console.log('Request failed');
1540            }
1541        });
1542    }
1543
1544    focusCurrentText(t18) {
1545        if (t18 === FocusText.TEXT1) {
1546            if (this.focusText === FocusText.NONE) {
1547                this.focusText = FocusText.TEXT1;
1548            }
1549            if (!this.hasFocusText1) {
1550                this.hasFocusText1 = true;
1551            }
1552        }
1553        else if (t18 === FocusText.TEXT2) {
1554            if (this.focusText === FocusText.NONE) {
1555                this.focusText = FocusText.TEXT2;
1556            }
1557            if (!this.hasFocusText2) {
1558                this.hasFocusText2 = true;
1559            }
1560        }
1561        else if (t18 === FocusText.TEXT3) {
1562            if (this.focusText === FocusText.NONE) {
1563                this.focusText = FocusText.TEXT3;
1564            }
1565            if (!this.hasFocusText3) {
1566                this.hasFocusText3 = true;
1567            }
1568        }
1569        else {
1570        }
1571    }
1572
1573    getMaxLength() {
1574        if (this.max.toString().length > this.min.toString().length) {
1575            return this.max.toString().length + 1;
1576        }
1577        else {
1578            return this.min.toString().length + 1;
1579        }
1580    }
1581
1582    resourceToVp(r18) {
1583        try {
1584            if (r18.id !== -1) {
1585                return px2vp(getContext(this).resourceManager.getNumber(r18.id));
1586            }
1587            else {
1588                return px2vp(getContext(this)
1589                    .resourceManager
1590                    .getNumberByName((r18.params[0]).split('.')[2]));
1591            }
1592        }
1593        catch (s18) {
1594            return CounterResource.COUNTER_LIST_PADDING;
1595        }
1596    }
1597
1598    initialRender() {
1599        this.observeComponentCreation2((g6, h6) => {
1600            If.create();
1601            if (this.type === CounterType.LIST) {
1602                this.ifElseBranchUpdateFunction(0, () => {
1603                    this.observeComponentCreation2((p18, q18) => {
1604                        RelativeContainer.create();
1605                        RelativeContainer.direction(this.counterDirection);
1606                        RelativeContainer.width('100%');
1607                        RelativeContainer.height(CounterResource.COUNTER_LIST_HEIGHT);
1608                    }, RelativeContainer);
1609                    this.observeComponentCreation2((n18, o18) => {
1610                        Text.create(this.numberStyleOptions.label);
1611                        Text.direction(this.counterDirection);
1612                        Text.fontSize(CounterResource.COUNTER_LIST_LABEL_SIZE);
1613                        Text.maxFontScale(CounterResource.COUNTER_LABEL_MAX_FONT_SIZE_SCALE);
1614                        Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
1615                        Text.margin({
1616                            start: LengthMetrics.vp(this.resourceToVp(CounterResource.COUNTER_LIST_LEFT_PADDING))
1617                        });
1618                        Text.alignRules({
1619                            center: { anchor: '__container__', align: VerticalAlign.Center },
1620                            start: { anchor: '__container__', align: HorizontalAlign.Start },
1621                            end: { anchor: 'Row1', align: HorizontalAlign.Start }
1622                        });
1623                        Text.id('Text');
1624                    }, Text);
1625                    Text.pop();
1626                    this.observeComponentCreation2((l18, m18) => {
1627                        Row.create();
1628                        Row.direction(this.counterDirection);
1629                        Row.height(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1630                        Row.margin({
1631                            end: LengthMetrics.vp(this.resourceToVp(CounterResource.COUNTER_LIST_RIGHT_PADDING))
1632                        });
1633                        Row.alignRules({
1634                            center: { anchor: '__container__', align: VerticalAlign.Center },
1635                            end: { anchor: '__container__', align: HorizontalAlign.End }
1636                        });
1637                        Row.tabIndex(0);
1638                        Row.id('Row1');
1639                    }, Row);
1640                    this.observeComponentCreation2((j18, k18) => {
1641                        Stack.create();
1642                        Stack.direction(this.counterDirection);
1643                        Stack.width(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1644                        Stack.height(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1645                        Stack.borderRadius(CounterResource.COUNTER_LIST_BUTTON_RADIUS);
1646                        Stack.borderWidth(this.subBtnFocusWidh);
1647                        Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
1648                        Stack.clip(true);
1649                    }, Stack);
1650                    this.observeComponentCreation2((h18, i18) => {
1651                        Image.create(CounterResource.BUTTON_SUB_ICON);
1652                        Image.direction(this.counterDirection);
1653                        Image.width(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE);
1654                        Image.height(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE);
1655                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
1656                        Image.opacity(this.subOpacity);
1657                    }, Image);
1658                    this.observeComponentCreation2((v17, w17) => {
1659                        Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.subBtnStateEffect });
1660                        Button.direction(this.counterDirection);
1661                        Button.width(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1662                        Button.height(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1663                        Button.responseRegion({
1664                            x: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_X,
1665                            y: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_Y,
1666                            width: '150%',
1667                            height: '150%'
1668                        });
1669                        Button.groupDefaultFocus(true);
1670                        Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR);
1671                        Button.opacity(this.subOpacity);
1672                        Button.enabled(this.subBtnEnabled);
1673                        Button.key('ListSubButton' + this.timeStamp.toString());
1674                        Button.onKeyEvent((g18) => {
1675                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
1676                            if (g18.keyCode === CounterConstant.KEYCODE_ESC) {
1677                                this.resetFocusButton();
1678                                g18.stopPropagation();
1679                            }
1680                            if (g18.type === KeyType.Down &&
1681                                g18.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
1682                                g18.stopPropagation();
1683                                this.homeFirstValue();
1684                                this.focusWithTarget('ListAddButton' + this.timeStamp.toString());
1685                            }
1686                            if (g18.type === KeyType.Down &&
1687                                g18.keyCode === CounterConstant.KEYCODE_MOVE_END) {
1688                                g18.stopPropagation();
1689                                if (this.addBtnStateEffect) {
1690                                    this.addBtnStateEffect = false;
1691                                    this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1692                                    this.addBtnEnabled = false;
1693                                }
1694                                this.endLastValue();
1695                                this.focusWithTarget('ListAddButton' + this.timeStamp.toString());
1696                            }
1697                        });
1698                        Button.onClick((f18) => {
1699                            this.subValue();
1700                            this.onChange?.(ObservedObject.GetRawObject(this.value));
1701                            if (f18.source === SourceType.Mouse ||
1702                                f18.source === SourceType.TouchScreen) {
1703                                this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1704                            }
1705                        });
1706                        Gesture.create(GesturePriority.Low);
1707                        LongPressGesture.create({ repeat: true });
1708                        LongPressGesture.onAction((e18) => {
1709                            if (e18.repeat) {
1710                                this.subValue();
1711                                this.onChange?.(ObservedObject.GetRawObject(this.value));
1712                            }
1713                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1714                        });
1715                        LongPressGesture.pop();
1716                        Gesture.pop();
1717                        Button.hoverEffect(this.choverEffect);
1718                        Button.onHover((d18) => {
1719                            this.onHoverDecrease && this.onHoverDecrease(d18);
1720                        });
1721                        Button.focusable(this.focusEnable);
1722                        Button.onFocus(() => {
1723                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
1724                            this.onFocusDecrease && this.onFocusDecrease();
1725                            this.updateButtonStatus();
1726                        });
1727                        Button.onBlur(() => {
1728                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1729                            this.onBlurDecrease && this.onBlurDecrease();
1730                        });
1731                    }, Button);
1732                    Button.pop();
1733                    Stack.pop();
1734                    this.observeComponentCreation2((l17, m17) => {
1735                        If.create();
1736                        if (this.hasTextWidth) {
1737                            this.ifElseBranchUpdateFunction(0, () => {
1738                                this.observeComponentCreation2((t17, u17) => {
1739                                    Text.create(this.value.toString());
1740                                    Text.direction(this.counterDirection);
1741                                    Text.width(this.textWidth.toString());
1742                                    Text.textAlign(TextAlign.Center);
1743                                    Text.fontSize(CounterResource.COUNTER_LIST_NUMBER_SIZE);
1744                                    Text.maxFontScale(CounterResource.COUNTER_NUMBER_MAX_FONT_SIZE_SCALE);
1745                                    Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
1746                                    Text.margin({
1747                                        start: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN),
1748                                        end: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN)
1749                                    });
1750                                }, Text);
1751                                Text.pop();
1752                            });
1753                        }
1754                        else {
1755                            this.ifElseBranchUpdateFunction(1, () => {
1756                                this.observeComponentCreation2((p17, q17) => {
1757                                    Text.create(this.value.toString());
1758                                    Text.direction(this.counterDirection);
1759                                    Text.textAlign(TextAlign.Center);
1760                                    Text.fontSize(CounterResource.COUNTER_LIST_NUMBER_SIZE);
1761                                    Text.maxFontScale(CounterResource.COUNTER_NUMBER_MAX_FONT_SIZE_SCALE);
1762                                    Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
1763                                    Text.margin({
1764                                        start: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN),
1765                                        end: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN)
1766                                    });
1767                                }, Text);
1768                                Text.pop();
1769                            });
1770                        }
1771                    }, If);
1772                    If.pop();
1773                    this.observeComponentCreation2((j17, k17) => {
1774                        Stack.create();
1775                        Stack.direction(this.counterDirection);
1776                        Stack.width(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1777                        Stack.height(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1778                        Stack.borderRadius(CounterResource.COUNTER_LIST_BUTTON_RADIUS);
1779                        Stack.borderWidth(this.addBtnFocusWidh);
1780                        Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
1781                        Stack.clip(true);
1782                    }, Stack);
1783                    this.observeComponentCreation2((h17, i17) => {
1784                        Image.create(CounterResource.BUTTON_ADD_ICON);
1785                        Image.direction(this.counterDirection);
1786                        Image.width(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE);
1787                        Image.height(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE);
1788                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
1789                        Image.opacity(this.addOpacity);
1790                    }, Image);
1791                    this.observeComponentCreation2((v16, w16) => {
1792                        Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.addBtnStateEffect });
1793                        Button.direction(this.counterDirection);
1794                        Button.width(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1795                        Button.height(CounterResource.COUNTER_LIST_BUTTON_SIZE);
1796                        Button.responseRegion({
1797                            x: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_X,
1798                            y: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_Y,
1799                            width: '150%',
1800                            height: '150%'
1801                        });
1802                        Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR);
1803                        Button.opacity(this.addOpacity);
1804                        Button.enabled(this.addBtnEnabled);
1805                        Button.key('ListAddButton' + this.timeStamp.toString());
1806                        Button.onKeyEvent((g17) => {
1807                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
1808                            if (g17.keyCode === CounterConstant.KEYCODE_ESC) {
1809                                this.resetFocusButton();
1810                                g17.stopPropagation();
1811                            }
1812                            if (g17.type === KeyType.Down &&
1813                                g17.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
1814                                g17.stopPropagation();
1815                                this.homeFirstValue();
1816                                if (this.subBtnStateEffect) {
1817                                    this.subBtnStateEffect = false;
1818                                    this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1819                                    this.subBtnEnabled = false;
1820                                }
1821                                this.focusWithTarget('ListAddButton' + this.timeStamp.toString());
1822                            }
1823                            if (g17.type === KeyType.Down &&
1824                                g17.keyCode === CounterConstant.KEYCODE_MOVE_END) {
1825                                g17.stopPropagation();
1826                                this.endLastValue();
1827                                this.focusWithTarget('ListSubButton' + this.timeStamp.toString());
1828                            }
1829                        });
1830                        Button.onClick((f17) => {
1831                            this.addValue();
1832                            this.onChange?.(ObservedObject.GetRawObject(this.value));
1833                            if (f17.source === SourceType.Mouse ||
1834                                f17.source === SourceType.TouchScreen) {
1835                                this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1836                            }
1837                        });
1838                        Gesture.create(GesturePriority.Low);
1839                        LongPressGesture.create({ repeat: true });
1840                        LongPressGesture.onAction((e17) => {
1841                            if (e17.repeat) {
1842                                this.addValue();
1843                                this.onChange?.(ObservedObject.GetRawObject(this.value));
1844                            }
1845                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1846                        });
1847                        LongPressGesture.pop();
1848                        Gesture.pop();
1849                        Button.hoverEffect(this.choverEffect);
1850                        Button.onHover((d17) => {
1851                            this.onHoverIncrease && this.onHoverIncrease(d17);
1852                        });
1853                        Button.focusable(this.focusEnable);
1854                        Button.onFocus(() => {
1855                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
1856                            this.onFocusIncrease && this.onFocusIncrease();
1857                            this.updateButtonStatus();
1858                        });
1859                        Button.onBlur(() => {
1860                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1861                            this.onBlurIncrease && this.onBlurIncrease();
1862                        });
1863                    }, Button);
1864                    Button.pop();
1865                    Stack.pop();
1866                    Row.pop();
1867                    RelativeContainer.pop();
1868                });
1869            }
1870            else if (this.type === CounterType.COMPACT) {
1871                this.ifElseBranchUpdateFunction(1, () => {
1872                    this.observeComponentCreation2((i16, j16) => {
1873                        Column.create();
1874                    }, Column);
1875                    this.observeComponentCreation2((g16, h16) => {
1876                        Row.create();
1877                        Row.direction(this.counterDirection);
1878                        Row.tabIndex(0);
1879                        Row.height(CounterResource.COUNTER_COMPACT_CONTAINER_HEIGHT);
1880                        Row.align(Alignment.Center);
1881                        Row.borderWidth(CounterResource.COUNTER_BORDER_WIDTH);
1882                        Row.borderColor(CounterResource.COUNTER_BORDER_COLOR);
1883                        Row.borderRadius(CounterResource.COUNTER_COMPACT_CONTAINER_RADIUS);
1884                    }, Row);
1885                    this.observeComponentCreation2((e16, f16) => {
1886                        Stack.create();
1887                        Stack.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
1888                        Stack.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
1889                        Stack.borderRadius(CounterResource.COUNTER_COMPACT_BUTTON_RADIUS);
1890                        Stack.borderWidth(this.subBtnFocusWidh);
1891                        Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
1892                        Stack.margin({ start: LengthMetrics.vp(1) });
1893                        Stack.clip(true);
1894                    }, Stack);
1895                    this.observeComponentCreation2((c16, d16) => {
1896                        Image.create(CounterResource.BUTTON_SUB_ICON);
1897                        Image.direction(this.counterDirection);
1898                        Image.width(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE);
1899                        Image.height(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE);
1900                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
1901                        Image.opacity(this.subOpacity);
1902                    }, Image);
1903                    this.observeComponentCreation2((q15, r15) => {
1904                        Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.subBtnStateEffect });
1905                        Button.direction(this.counterDirection);
1906                        Button.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
1907                        Button.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
1908                        Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR);
1909                        Button.opacity(this.subOpacity);
1910                        Button.enabled(this.subBtnEnabled);
1911                        Button.key('CompactSubButton' + this.timeStamp.toString());
1912                        Button.onKeyEvent((b16) => {
1913                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
1914                            if (b16.keyCode === CounterConstant.KEYCODE_ESC) {
1915                                this.resetFocusButton();
1916                                b16.stopPropagation();
1917                            }
1918                            if (b16.type === KeyType.Down &&
1919                                b16.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
1920                                b16.stopPropagation();
1921                                this.homeFirstValue();
1922                                this.focusWithTarget('CompactAddButton' + this.timeStamp.toString());
1923                            }
1924                            if (b16.type === KeyType.Down &&
1925                                b16.keyCode === CounterConstant.KEYCODE_MOVE_END) {
1926                                b16.stopPropagation();
1927                                this.endLastValue();
1928                                if (this.addBtnStateEffect) {
1929                                    this.addBtnStateEffect = false;
1930                                    this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
1931                                    this.addBtnEnabled = false;
1932                                }
1933                                this.focusWithTarget('CompactSubButton' + this.timeStamp.toString());
1934                            }
1935                        });
1936                        Button.onClick((a16) => {
1937                            this.subValue();
1938                            this.onChange?.(ObservedObject.GetRawObject(this.value));
1939                            if (a16.source === SourceType.Mouse ||
1940                                a16.source === SourceType.TouchScreen) {
1941                                this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1942                            }
1943                        });
1944                        Gesture.create(GesturePriority.Low);
1945                        LongPressGesture.create({ repeat: true });
1946                        LongPressGesture.onAction((z15) => {
1947                            if (z15.repeat) {
1948                                this.subValue();
1949                                this.onChange?.(ObservedObject.GetRawObject(this.value));
1950                            }
1951                            if (z15.source === SourceType.Mouse ||
1952                                z15.source === SourceType.TouchScreen) {
1953                                this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1954                            }
1955                        });
1956                        LongPressGesture.pop();
1957                        Gesture.pop();
1958                        Button.hoverEffect(this.choverEffect);
1959                        Button.onHover((y15) => {
1960                            this.onHoverDecrease && this.onHoverDecrease(y15);
1961                        });
1962                        Button.focusable(this.focusEnable);
1963                        Button.groupDefaultFocus(true);
1964                        Button.onFocus(() => {
1965                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
1966                            this.onFocusDecrease && this.onFocusDecrease();
1967                            this.updateButtonStatus();
1968                        });
1969                        Button.onBlur(() => {
1970                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
1971                            this.onBlurDecrease && this.onBlurDecrease();
1972                        });
1973                    }, Button);
1974                    Button.pop();
1975                    Stack.pop();
1976                    this.observeComponentCreation2((g15, h15) => {
1977                        If.create();
1978                        if (this.hasTextWidth) {
1979                            this.ifElseBranchUpdateFunction(0, () => {
1980                                this.observeComponentCreation2((o15, p15) => {
1981                                    Text.create(this.value.toString());
1982                                    Text.textAlign(TextAlign.Center);
1983                                    Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE);
1984                                    Text.maxFontScale(CounterResource.COUNTER_NUMBER_MAX_FONT_SIZE_SCALE);
1985                                    Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
1986                                    Text.width(this.textWidth.toString());
1987                                    Text.margin({
1988                                        start: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN),
1989                                        end: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN)
1990                                    });
1991                                }, Text);
1992                                Text.pop();
1993                            });
1994                        }
1995                        else {
1996                            this.ifElseBranchUpdateFunction(1, () => {
1997                                this.observeComponentCreation2((k15, l15) => {
1998                                    Text.create(this.value.toString());
1999                                    Text.direction(this.counterDirection);
2000                                    Text.textAlign(TextAlign.Center);
2001                                    Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE);
2002                                    Text.maxFontScale(CounterResource.COUNTER_NUMBER_MAX_FONT_SIZE_SCALE);
2003                                    Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
2004                                    Text.margin({
2005                                        start: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN),
2006                                        end: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN)
2007                                    });
2008                                }, Text);
2009                                Text.pop();
2010                            });
2011                        }
2012                    }, If);
2013                    If.pop();
2014                    this.observeComponentCreation2((e15, f15) => {
2015                        Stack.create();
2016                        Stack.direction(this.counterDirection);
2017                        Stack.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
2018                        Stack.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
2019                        Stack.borderRadius(CounterResource.COUNTER_COMPACT_BUTTON_RADIUS);
2020                        Stack.borderWidth(this.addBtnFocusWidh);
2021                        Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
2022                        Stack.margin({ end: LengthMetrics.vp(1) });
2023                        Stack.clip(true);
2024                    }, Stack);
2025                    this.observeComponentCreation2((c15, d15) => {
2026                        Image.create(CounterResource.BUTTON_ADD_ICON);
2027                        Image.direction(this.counterDirection);
2028                        Image.width(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE);
2029                        Image.height(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE);
2030                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
2031                        Image.opacity(this.addOpacity);
2032                    }, Image);
2033                    this.observeComponentCreation2((q14, r14) => {
2034                        Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.addBtnStateEffect });
2035                        Button.direction(this.counterDirection);
2036                        Button.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
2037                        Button.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE);
2038                        Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR);
2039                        Button.opacity(this.addOpacity);
2040                        Button.enabled(this.addBtnEnabled);
2041                        Button.key('CompactAddButton' + this.timeStamp.toString());
2042                        Button.onKeyEvent((b15) => {
2043                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
2044                            if (b15.keyCode === CounterConstant.KEYCODE_ESC) {
2045                                this.resetFocusButton();
2046                                b15.stopPropagation();
2047                            }
2048                            if (b15.type === KeyType.Down &&
2049                                b15.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
2050                                b15.stopPropagation();
2051                                this.homeFirstValue();
2052                                if (this.subBtnStateEffect) {
2053                                    this.subBtnStateEffect = false;
2054                                    this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY;
2055                                    this.subBtnEnabled = false;
2056                                }
2057                                this.focusWithTarget('CompactAddButton' + this.timeStamp.toString());
2058                            }
2059                            if (b15.type === KeyType.Down &&
2060                                b15.keyCode === CounterConstant.KEYCODE_MOVE_END) {
2061                                b15.stopPropagation();
2062                                this.endLastValue();
2063                                this.focusWithTarget('CompactSubButton' + this.timeStamp.toString());
2064                            }
2065                        });
2066                        Button.onClick((a15) => {
2067                            this.addValue();
2068                            this.onChange?.(ObservedObject.GetRawObject(this.value));
2069                            if (a15.source === SourceType.Mouse ||
2070                                a15.source === SourceType.TouchScreen) {
2071                                this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2072                            }
2073                        });
2074                        Gesture.create(GesturePriority.Low);
2075                        LongPressGesture.create({ repeat: true });
2076                        LongPressGesture.onAction((z14) => {
2077                            if (z14.repeat) {
2078                                this.addValue();
2079                                this.onChange?.(ObservedObject.GetRawObject(this.value));
2080                            }
2081                            if (z14.source === SourceType.Mouse ||
2082                                z14.source === SourceType.TouchScreen) {
2083                                this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2084                            }
2085                        });
2086                        LongPressGesture.pop();
2087                        Gesture.pop();
2088                        Button.hoverEffect(this.choverEffect);
2089                        Button.onHover((y14) => {
2090                            this.onHoverIncrease && this.onHoverIncrease(y14);
2091                        });
2092                        Button.focusable(this.focusEnable);
2093                        Button.onFocus(() => {
2094                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
2095                            this.onFocusIncrease && this.onFocusIncrease();
2096                            this.updateButtonStatus();
2097                        });
2098                        Button.onBlur(() => {
2099                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2100                            this.onBlurIncrease && this.onBlurIncrease();
2101                        });
2102                    }, Button);
2103                    Button.pop();
2104                    Stack.pop();
2105                    Row.pop();
2106                    this.observeComponentCreation2((o14, p14) => {
2107                        Text.create(this.numberStyleOptions.label);
2108                        Text.direction(this.counterDirection);
2109                        Text.margin({ top: CounterResource.COUNTER_COMPACT_CONTAINER_LABEL_DISTANCE });
2110                        Text.fontSize(CounterResource.COUNTER_COMPACT_LABEL_SIZE);
2111                        Text.maxFontScale(CounterResource.COUNTER_LABEL_MAX_FONT_SIZE_SCALE);
2112                        Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
2113                        Text.align(Alignment.Top);
2114                    }, Text);
2115                    Text.pop();
2116                    Column.pop();
2117                });
2118            }
2119            else if (this.type === CounterType.INLINE) {
2120                this.ifElseBranchUpdateFunction(2, () => {
2121                    this.observeComponentCreation2((b14, c14) => {
2122                        Row.create();
2123                        Row.direction(this.counterDirection);
2124                        Row.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT);
2125                        Row.borderWidth(CounterResource.COUNTER_BORDER_WIDTH);
2126                        Row.borderColor(CounterResource.COUNTER_BORDER_COLOR);
2127                        Row.borderRadius(CounterResource.COUNTER_INLINE_RADIUS);
2128                        Row.clip(true);
2129                    }, Row);
2130                    this.observeComponentCreation2((j12, k12) => {
2131                        If.create();
2132                        if (this.hasTextWidth) {
2133                            this.ifElseBranchUpdateFunction(0, () => {
2134                                this.observeComponentCreation2((z13, a14) => {
2135                                    RelativeContainer.create();
2136                                    RelativeContainer.direction(this.counterDirection);
2137                                    RelativeContainer.margin({
2138                                        start: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN),
2139                                        end: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN)
2140                                    });
2141                                    RelativeContainer.height('100%');
2142                                    RelativeContainer.width(this.textWidth);
2143                                }, RelativeContainer);
2144                                this.observeComponentCreation2((j13, k13) => {
2145                                    TextInput.create({
2146                                        text: this.hasInputText1 ? this.inputValue : this.value.toString(),
2147                                        controller: this.controller1
2148                                    });
2149                                    TextInput.alignRules({
2150                                        center: { anchor: '__container__', align: VerticalAlign.Center },
2151                                        middle: { anchor: '__container__', align: HorizontalAlign.Center }
2152                                    });
2153                                    TextInput.width(Math.min(this.getValueLength() * 9.6, this.textWidth));
2154                                    TextInput.height('20vp');
2155                                    TextInput.padding(0);
2156                                    TextInput.borderRadius(0);
2157                                    TextInput.textAlign(TextAlign.Center);
2158                                    TextInput.type(InputType.PhoneNumber);
2159                                    TextInput.caretColor(Color.Transparent);
2160                                    TextInput.copyOption(CopyOptions.None);
2161                                    TextInput.fontSize(this.getTextInputFontSize());
2162                                    TextInput.fontWeight(FontWeight.Medium);
2163                                    TextInput.fontColor(this.hasFocusText1 ? Color.White : CounterResource.COUNTER_TEXT_COLOR);
2164                                    TextInput.maxLength(this.getMaxLength());
2165                                    TextInput.backgroundColor(this.hasFocusText1 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent);
2166                                    TextInput.key('InlineTextInput' + this.timeStamp.toString());
2167                                    TextInput.onKeyEvent((y13) => {
2168                                        this.focusCurrentText(FocusText.TEXT1);
2169                                        if (y13.keyCode === CounterConstant.KEYCODE_ESC) {
2170                                            this.resetFocusText();
2171                                            y13.stopPropagation();
2172                                        }
2173                                        if (y13.type === KeyType.Down &&
2174                                            y13.keyCode === CounterConstant.KEYCODE_DPAD_UP) {
2175                                            this.addValue();
2176                                            y13.stopPropagation();
2177                                        }
2178                                        if (y13.type === KeyType.Down &&
2179                                            y13.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
2180                                            y13.stopPropagation();
2181                                            this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2182                                        }
2183                                        if (y13.type === KeyType.Down &&
2184                                            y13.keyCode === CounterConstant.KEYCODE_MOVE_END) {
2185                                            y13.stopPropagation();
2186                                            this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2187                                        }
2188                                        if (y13.type === KeyType.Down &&
2189                                            y13.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) {
2190                                            this.subValue();
2191                                            y13.stopPropagation();
2192                                        }
2193                                        if (y13.type === KeyType.Down &&
2194                                            y13.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) {
2195                                            this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2196                                            y13.stopPropagation();
2197                                        }
2198                                        if (y13.type === KeyType.Down &&
2199                                            y13.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) {
2200                                            this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2201                                            y13.stopPropagation();
2202                                        }
2203                                    });
2204                                    TextInput.onChange((t13) => {
2205                                        this.inputValue = t13;
2206                                        for (let w13 = 0; w13 < t13.length; w13++) {
2207                                            let x13 = t13[w13];
2208                                            if (x13 === '+' || x13 === '*' || x13 === '#') {
2209                                                this.value -= 1;
2210                                                this.value += 1;
2211                                                this.inputValue = this.value.toString();
2212                                                return;
2213                                            }
2214                                            if (x13 === '-' && w13 !== 0) {
2215                                                this.inputValue = x13;
2216                                                break;
2217                                            }
2218                                        }
2219                                        this.hasInputText1 = true;
2220                                        let u13 = t13[t13.length - 1];
2221                                        if (t13.length === this.getMaxLength()) {
2222                                            this.inputValue = u13;
2223                                        }
2224                                        if (this.timeoutID1 !== -1) {
2225                                            clearTimeout(this.timeoutID1);
2226                                            this.timeoutID1 = -1;
2227                                        }
2228                                        if (this.inputValue !== '' && Number(this.inputValue) <= this.max &&
2229                                            Number(this.inputValue) >= this.min) {
2230                                            this.value = Number(this.inputValue);
2231                                            this.onChange?.(ObservedObject.GetRawObject(this.value));
2232                                            this.hasInputText1 = false;
2233                                        }
2234                                        else {
2235                                            if (Number(this.inputValue) > this.max ||
2236                                                (Number(this.inputValue) < this.min &&
2237                                                    this.inputValue.length <= this.min.toString().length)) {
2238                                                this.inputValue = u13;
2239                                            }
2240                                            if (t13.length < this.getMaxLength()) {
2241                                                this.timeoutID1 = setTimeout(() => {
2242                                                    if (this.inputValue !== '' && Number(this.inputValue) <= this.max &&
2243                                                        Number(this.inputValue) >= this.min) {
2244                                                        this.value = Number(this.inputValue);
2245                                                        this.onChange?.(ObservedObject.GetRawObject(this.value));
2246                                                    }
2247                                                    this.inputValue = this.value.toString();
2248                                                    this.hasInputText1 = false;
2249                                                    this.updateInlineEnableSate();
2250                                                }, 1500);
2251                                            }
2252                                        }
2253                                        this.updateInlineEnableSate();
2254                                    });
2255                                    TextInput.onSubmit((s13) => {
2256                                        if (this.timeoutID1 != -1) {
2257                                            clearTimeout(this.timeoutID1);
2258                                            this.timeoutID1 = -1;
2259                                        }
2260                                        this.hasInputText1 = false;
2261                                        this.value -= 1;
2262                                        if (Number(this.inputValue) >= this.min && Number(this.inputValue) <= this.max) {
2263                                            this.value = Number(this.inputValue);
2264                                            this.onChange?.(ObservedObject.GetRawObject(this.value));
2265                                            this.updateInlineEnableSate();
2266                                        }
2267                                        else {
2268                                            this.value += 1;
2269                                            this.inputValue = this.value.toString();
2270                                        }
2271                                    });
2272                                    TextInput.focusable(true);
2273                                    TextInput.focusOnTouch(true);
2274                                    TextInput.onFocus(() => {
2275                                        this.focusText = FocusText.TEXT1;
2276                                        this.hasFocusText1 = true;
2277                                        this.controller1.caretPosition(this.value.toString().length);
2278                                    });
2279                                    TextInput.onBlur(() => {
2280                                        this.focusText = FocusText.NONE;
2281                                        this.hasFocusText1 = false;
2282                                    });
2283                                    TextInput.onClick((r13) => {
2284                                        this.focusText = FocusText.TEXT1;
2285                                        this.hasFocusText1 = true;
2286                                        this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2287                                        this.controller1.caretPosition(this.value.toString().length);
2288                                    });
2289                                }, TextInput);
2290                                RelativeContainer.pop();
2291                            });
2292                        }
2293                        else {
2294                            this.ifElseBranchUpdateFunction(1, () => {
2295                                this.observeComponentCreation2((e13, f13) => {
2296                                    Row.create();
2297                                    Row.direction(this.counterDirection);
2298                                    Row.margin({
2299                                        start: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN),
2300                                        end: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN)
2301                                    });
2302                                }, Row);
2303                                this.observeComponentCreation2((o12, p12) => {
2304                                    TextInput.create({
2305                                        text: this.hasInputText1 ? this.inputValue : this.value.toString(),
2306                                        controller: this.controller1
2307                                    });
2308                                    TextInput.direction(this.counterDirection);
2309                                    TextInput.width(this.getValueLength() * 9.6);
2310                                    TextInput.height('20vp');
2311                                    TextInput.padding(0);
2312                                    TextInput.borderRadius(0);
2313                                    TextInput.textAlign(TextAlign.Center);
2314                                    TextInput.type(InputType.PhoneNumber);
2315                                    TextInput.caretColor(Color.Transparent);
2316                                    TextInput.copyOption(CopyOptions.None);
2317                                    TextInput.fontSize(this.getTextInputFontSize());
2318                                    TextInput.fontWeight(FontWeight.Medium);
2319                                    TextInput.fontColor(this.hasFocusText1 ? Color.White : CounterResource.COUNTER_TEXT_COLOR);
2320                                    TextInput.maxLength(this.getMaxLength());
2321                                    TextInput.backgroundColor(this.hasFocusText1 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent);
2322                                    TextInput.key('InlineTextInput' + this.timeStamp.toString());
2323                                    TextInput.onKeyEvent((d13) => {
2324                                        this.focusCurrentText(FocusText.TEXT1);
2325                                        if (d13.keyCode === CounterConstant.KEYCODE_ESC) {
2326                                            this.resetFocusText();
2327                                            d13.stopPropagation();
2328                                        }
2329                                        if (d13.type === KeyType.Down &&
2330                                            d13.keyCode === CounterConstant.KEYCODE_DPAD_UP) {
2331                                            this.addValue();
2332                                            d13.stopPropagation();
2333                                        }
2334                                        if (d13.type === KeyType.Down &&
2335                                            d13.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) {
2336                                            this.subValue();
2337                                            d13.stopPropagation();
2338                                        }
2339                                        if (d13.type === KeyType.Down &&
2340                                            d13.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) {
2341                                            this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2342                                            d13.stopPropagation();
2343                                        }
2344                                        if (d13.type === KeyType.Down &&
2345                                            d13.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) {
2346                                            this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2347                                            d13.stopPropagation();
2348                                        }
2349                                    });
2350                                    TextInput.onChange((y12) => {
2351                                        this.inputValue = y12;
2352                                        for (let b13 = 0; b13 < y12.length; b13++) {
2353                                            let c13 = y12[b13];
2354                                            if (c13 === '+' || c13 === '*' || c13 === '#') {
2355                                                this.value -= 1;
2356                                                this.value += 1;
2357                                                this.inputValue = this.value.toString();
2358                                                return;
2359                                            }
2360                                            if (c13 === '-' && b13 !== 0) {
2361                                                this.inputValue = c13;
2362                                                break;
2363                                            }
2364                                        }
2365                                        this.hasInputText1 = true;
2366                                        let z12 = y12[y12.length - 1];
2367                                        if (y12.length === this.getMaxLength()) {
2368                                            this.inputValue = z12;
2369                                        }
2370                                        if (this.timeoutID1 !== -1) {
2371                                            clearTimeout(this.timeoutID1);
2372                                            this.timeoutID1 = -1;
2373                                        }
2374                                        if (this.inputValue !== '' && Number(this.inputValue) <= this.max &&
2375                                            Number(this.inputValue) >= this.min) {
2376                                            this.value = Number(this.inputValue);
2377                                            this.onChange?.(ObservedObject.GetRawObject(this.value));
2378                                            this.hasInputText1 = false;
2379                                        }
2380                                        else {
2381                                            if (Number(this.inputValue) > this.max ||
2382                                                (Number(this.inputValue) < this.min &&
2383                                                    this.inputValue.length <= this.min.toString().length)) {
2384                                                this.inputValue = z12;
2385                                            }
2386                                            if (y12.length < this.getMaxLength()) {
2387                                                this.timeoutID1 = setTimeout(() => {
2388                                                    if (this.inputValue !== '' && Number(this.inputValue) <= this.max &&
2389                                                        Number(this.inputValue) >= this.min) {
2390                                                        this.value = Number(this.inputValue);
2391                                                        this.onChange?.(ObservedObject.GetRawObject(this.value));
2392                                                    }
2393                                                    this.inputValue = this.value.toString();
2394                                                    this.hasInputText1 = false;
2395                                                    this.updateInlineEnableSate();
2396                                                }, 1500);
2397                                            }
2398                                        }
2399                                        this.updateInlineEnableSate();
2400                                    });
2401                                    TextInput.onSubmit((x12) => {
2402                                        if (this.timeoutID1 !== -1) {
2403                                            clearTimeout(this.timeoutID1);
2404                                            this.timeoutID1 = -1;
2405                                        }
2406                                        this.hasInputText1 = false;
2407                                        this.value -= 1;
2408                                        if (Number(this.inputValue) >= this.min && Number(this.inputValue) <= this.max) {
2409                                            this.value = Number(this.inputValue);
2410                                            this.onChange?.(ObservedObject.GetRawObject(this.value));
2411                                            this.updateInlineEnableSate();
2412                                        }
2413                                        else {
2414                                            this.value += 1;
2415                                            this.inputValue = this.value.toString();
2416                                        }
2417                                    });
2418                                    TextInput.focusable(true);
2419                                    TextInput.focusOnTouch(true);
2420                                    TextInput.onFocus(() => {
2421                                        this.focusText = FocusText.TEXT1;
2422                                        this.hasFocusText1 = true;
2423                                        this.controller1.caretPosition(this.value.toString().length);
2424                                    });
2425                                    TextInput.onBlur(() => {
2426                                        this.focusText = FocusText.NONE;
2427                                        this.hasFocusText1 = false;
2428                                    });
2429                                    TextInput.onClick((w12) => {
2430                                        this.focusText = FocusText.TEXT1;
2431                                        this.hasFocusText1 = true;
2432                                        this.focusWithTarget('InlineTextInput' + this.timeStamp.toString());
2433                                        this.controller1.caretPosition(this.value.toString().length);
2434                                    });
2435                                }, TextInput);
2436                                Row.pop();
2437                            });
2438                        }
2439                    }, If);
2440                    If.pop();
2441                    this.observeComponentCreation2((h12, i12) => {
2442                        Column.create();
2443                        Column.direction(this.counterDirection);
2444                        Column.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
2445                        Column.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT);
2446                        Column.borderWidth({ start: LengthMetrics.vp(CounterResource.COUNTER_BORDER_WIDTH_NUMBER) });
2447                        Column.borderColor(CounterResource.COUNTER_BORDER_COLOR);
2448                    }, Column);
2449                    this.observeComponentCreation2((f12, g12) => {
2450                        Stack.create();
2451                        Stack.direction(this.counterDirection);
2452                        Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
2453                        Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
2454                        Stack.padding({ top: '1vp' });
2455                        Stack.borderWidth({ bottom: '1vp' });
2456                        Stack.borderColor(CounterResource.COUNTER_BORDER_COLOR);
2457                        Stack.clip(true);
2458                    }, Stack);
2459                    this.observeComponentCreation2((d12, e12) => {
2460                        Rect.create();
2461                        Rect.direction(this.counterDirection);
2462                        Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH);
2463                        Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT);
2464                        Rect.radius([
2465                            ['0vp', '0vp'],
2466                            [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS],
2467                            ['0vp', '0vp'],
2468                            ['0vp', '0vp']
2469                        ]);
2470                        Rect.strokeWidth(this.addBtnFocusWidh);
2471                        Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
2472                        Rect.margin({ end: LengthMetrics.vp(2) });
2473                        Rect.fillOpacity(0);
2474                    }, Rect);
2475                    this.observeComponentCreation2((b12, c12) => {
2476                        Image.create(CounterResource.BUTTON_ARROW_UP);
2477                        Image.direction(this.counterDirection);
2478                        Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH);
2479                        Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT);
2480                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
2481                        Image.opacity(this.addOpacity);
2482                    }, Image);
2483                    this.observeComponentCreation2((r11, s11) => {
2484                        Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.addBtnStateEffect });
2485                        Button.direction(this.counterDirection);
2486                        Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
2487                        Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
2488                        Button.backgroundColor(Color.Transparent);
2489                        Button.opacity(this.addOpacity);
2490                        Button.enabled(this.addBtnEnabled);
2491                        Button.onClick((a12) => {
2492                            this.addValue();
2493                            if (a12.source === SourceType.Mouse ||
2494                                a12.source === SourceType.TouchScreen) {
2495                                this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2496                            }
2497                        });
2498                        Gesture.create(GesturePriority.Low);
2499                        LongPressGesture.create({ repeat: true });
2500                        LongPressGesture.onAction((z11) => {
2501                            if (z11.repeat) {
2502                                this.addValue();
2503                            }
2504                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2505                        });
2506                        LongPressGesture.pop();
2507                        Gesture.pop();
2508                        Button.hoverEffect(this.choverEffect);
2509                        Button.onHover((y11) => {
2510                            this.onHoverIncrease && this.onHoverIncrease(y11);
2511                        });
2512                        Button.focusable(false);
2513                        Button.onFocus(() => {
2514                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
2515                            this.onFocusIncrease && this.onFocusIncrease();
2516                        });
2517                        Button.onBlur(() => {
2518                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2519                            this.onBlurIncrease && this.onBlurIncrease();
2520                        });
2521                    }, Button);
2522                    Button.pop();
2523                    Stack.pop();
2524                    this.observeComponentCreation2((p11, q11) => {
2525                        Stack.create();
2526                        Stack.direction(this.counterDirection);
2527                        Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
2528                        Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
2529                        Stack.clip(true);
2530                    }, Stack);
2531                    this.observeComponentCreation2((n11, o11) => {
2532                        Rect.create();
2533                        Rect.direction(this.counterDirection);
2534                        Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH);
2535                        Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT);
2536                        Rect.radius([
2537                            ['0vp', '0vp'],
2538                            ['0vp', '0vp'],
2539                            [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS],
2540                            ['0vp', '0vp']
2541                        ]);
2542                        Rect.strokeWidth(this.subBtnFocusWidh);
2543                        Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
2544                        Rect.margin({
2545                            top: LengthMetrics.vp(1),
2546                            end: LengthMetrics.vp(1),
2547                            bottom: LengthMetrics.vp(2)
2548                        });
2549                        Rect.fillOpacity(0);
2550                    }, Rect);
2551                    this.observeComponentCreation2((l11, m11) => {
2552                        Image.create(CounterResource.BUTTON_ARROW_DOWN);
2553                        Image.direction(this.counterDirection);
2554                        Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH);
2555                        Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT);
2556                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
2557                        Image.opacity(this.subOpacity);
2558                    }, Image);
2559                    this.observeComponentCreation2((b11, c11) => {
2560                        Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.subBtnStateEffect });
2561                        Button.direction(this.counterDirection);
2562                        Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
2563                        Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
2564                        Button.backgroundColor(Color.Transparent);
2565                        Button.opacity(this.subOpacity);
2566                        Button.enabled(this.subBtnEnabled);
2567                        Button.onClick((k11) => {
2568                            this.subValue();
2569                            if (k11.source === SourceType.Mouse ||
2570                                k11.source === SourceType.TouchScreen) {
2571                                this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2572                            }
2573                        });
2574                        Gesture.create(GesturePriority.Low);
2575                        LongPressGesture.create({ repeat: true });
2576                        LongPressGesture.onAction((j11) => {
2577                            if (j11.repeat) {
2578                                this.subValue();
2579                            }
2580                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2581                        });
2582                        LongPressGesture.pop();
2583                        Gesture.pop();
2584                        Button.hoverEffect(this.choverEffect);
2585                        Button.onHover((i11) => {
2586                            this.onHoverDecrease && this.onHoverDecrease(i11);
2587                        });
2588                        Button.focusable(false);
2589                        Button.onFocus(() => {
2590                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
2591                            this.onFocusDecrease && this.onFocusDecrease();
2592                        });
2593                        Button.onBlur(() => {
2594                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
2595                            this.onBlurDecrease && this.onBlurDecrease();
2596                        });
2597                    }, Button);
2598                    Button.pop();
2599                    Stack.pop();
2600                    Column.pop();
2601                    Row.pop();
2602                });
2603            }
2604            else if (this.type === CounterType.INLINE_DATE) {
2605                this.ifElseBranchUpdateFunction(3, () => {
2606                    this.observeComponentCreation2((n10, o10) => {
2607                        Row.create();
2608                        Row.direction(this.counterDirection);
2609                        Row.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT);
2610                        Row.borderWidth(CounterResource.COUNTER_BORDER_WIDTH);
2611                        Row.borderColor(CounterResource.COUNTER_BORDER_COLOR);
2612                        Row.borderRadius(CounterResource.COUNTER_INLINE_RADIUS);
2613                        Row.clip(true);
2614                    }, Row);
2615                    this.observeComponentCreation2((l10, m10) => {
2616                        Row.create();
2617                        Row.direction(this.counterDirection);
2618                        Row.width('92vp');
2619                        Row.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT);
2620                        Row.margin({
2621                            start: LengthMetrics.vp(CounterResource.COUNTER_INLINE_DATE_TEXT_MARGIN),
2622                            end: LengthMetrics.vp(CounterResource.COUNTER_INLINE_DATE_TEXT_MARGIN)
2623                        });
2624                    }, Row);
2625                    this.observeComponentCreation2((w9, x9) => {
2626                        TextInput.create({
2627                            text: this.hasInputText1 ? this.inputYear.toString() : this.getYear(),
2628                            controller: this.controller1
2629                        });
2630                        TextInput.direction(this.counterDirection);
2631                        TextInput.type(InputType.Number);
2632                        TextInput.caretColor(Color.Transparent);
2633                        TextInput.copyOption(CopyOptions.None);
2634                        TextInput.fontSize(this.getTextInputFontSize());
2635                        TextInput.fontWeight(FontWeight.Medium);
2636                        TextInput.fontColor(this.hasFocusText1 ? Color.White : CounterResource.COUNTER_TEXT_COLOR);
2637                        TextInput.maxLength(5);
2638                        TextInput.padding(0);
2639                        TextInput.backgroundColor(this.hasFocusText1 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent);
2640                        TextInput.width('38vp');
2641                        TextInput.height('20vp');
2642                        TextInput.borderRadius(0);
2643                        TextInput.borderWidth(0);
2644                        TextInput.key('DateTextInput1' + this.timeStamp.toString());
2645                        TextInput.onKeyEvent((k10) => {
2646                            this.focusCurrentText(FocusText.TEXT1);
2647                            if (k10.keyCode === CounterConstant.KEYCODE_ESC) {
2648                                this.resetFocusText();
2649                                k10.stopPropagation();
2650                            }
2651                            if (k10.type === KeyType.Down &&
2652                                k10.keyCode === CounterConstant.KEYCODE_DPAD_UP) {
2653                                this.addDate();
2654                                k10.stopPropagation();
2655                            }
2656                            if (k10.type === KeyType.Down &&
2657                                k10.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) {
2658                                this.subDate();
2659                                k10.stopPropagation();
2660                            }
2661                            if (k10.type === KeyType.Down &&
2662                                k10.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
2663                                this.homeFocusText();
2664                                k10.stopPropagation();
2665                            }
2666                            if (k10.type === KeyType.Down &&
2667                                k10.keyCode === CounterConstant.KEYCODE_MOVE_END) {
2668                                this.endFocusText();
2669                                k10.stopPropagation();
2670                            }
2671                            if (k10.type === KeyType.Down &&
2672                                k10.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) {
2673                                this.focusWithTarget('DateTextInput1' + this.timeStamp.toString());
2674                                k10.stopPropagation();
2675                            }
2676                            if (k10.type === KeyType.Down &&
2677                                k10.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) {
2678                                this.focusWithTarget('DateTextInput2' + this.timeStamp.toString());
2679                            }
2680                        });
2681                        TextInput.onChange((h10) => {
2682                            if (h10.length !== 4) {
2683                                this.hasInputText1 = true;
2684                            }
2685                            this.inputYear = Number(h10);
2686                            if (h10.length === 5) {
2687                                this.inputYear = this.inputYear % 10;
2688                            }
2689                            if (this.timeoutID1 !== -1) {
2690                                clearTimeout(this.timeoutID1);
2691                                this.timeoutID1 = -1;
2692                            }
2693                            this.timeoutID1 = setTimeout(() => {
2694                                this.hasInputText1 = false;
2695                                this.inputYear = this.year;
2696                                this.updateDateEnableSate();
2697                                this.updateDay();
2698                            }, 1500);
2699                            if (this.inputYear >= this.minYear && this.inputYear <= this.maxYear) {
2700                                this.year = this.inputYear;
2701                                this.updateDateEnableSate();
2702                                this.updateDay();
2703                            }
2704                            if (h10.length === 4) {
2705                                let j10 = new DateData(this.year, this.month, this.day);
2706                                this.onDateChange?.(j10);
2707                            }
2708                        });
2709                        TextInput.onSubmit((f10) => {
2710                            if (this.timeoutID1 !== -1) {
2711                                clearTimeout(this.timeoutID1);
2712                                this.timeoutID1 = -1;
2713                            }
2714                            this.hasInputText1 = false;
2715                            this.year -= 1;
2716                            if (this.inputYear >= this.minYear && this.inputYear <= this.maxYear) {
2717                                this.year = this.inputYear;
2718                            }
2719                            else {
2720                                this.year += 1;
2721                                this.inputYear = this.year;
2722                            }
2723                            this.updateDateEnableSate();
2724                            this.updateDay();
2725                        });
2726                        TextInput.tabIndex(0);
2727                        TextInput.focusOnTouch(true);
2728                        TextInput.focusable(true);
2729                        TextInput.onFocus(() => {
2730                            this.focusText = FocusText.TEXT1;
2731                            this.hasFocusText1 = true;
2732                            this.updateDateEnableSate();
2733                            this.controller1.caretPosition(this.getYear().length);
2734                        });
2735                        TextInput.onBlur(() => {
2736                            this.focusText = FocusText.NONE;
2737                            this.hasFocusText1 = false;
2738                            this.updateDateEnableSate();
2739                        });
2740                        TextInput.onClick((e10) => {
2741                            this.focusText = FocusText.TEXT1;
2742                            this.hasFocusText1 = true;
2743                            this.updateDateEnableSate();
2744                            this.controller1.caretPosition(this.getYear().length);
2745                        });
2746                    }, TextInput);
2747                    this.observeComponentCreation2((u9, v9) => {
2748                        Text.create('/');
2749                        Text.direction(this.counterDirection);
2750                        Text.textAlign(TextAlign.Center);
2751                        Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE);
2752                        Text.maxFontScale(CounterResource.COUNTER_NUMBER_MAX_FONT_SIZE_SCALE);
2753                        Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
2754                        Text.width('8vp');
2755                    }, Text);
2756                    Text.pop();
2757                    this.observeComponentCreation2((e9, f9) => {
2758                        TextInput.create({
2759                            text: this.hasInputText2 ? this.inputMoon.toString() : this.convertNumberToString(this.month),
2760                            controller: this.controller2
2761                        });
2762                        TextInput.direction(this.counterDirection);
2763                        TextInput.type(InputType.Number);
2764                        TextInput.caretColor(Color.Transparent);
2765                        TextInput.copyOption(CopyOptions.None);
2766                        TextInput.fontSize(this.getTextInputFontSize());
2767                        TextInput.fontWeight(FontWeight.Medium);
2768                        TextInput.fontColor(this.hasFocusText2 ? Color.White : CounterResource.COUNTER_TEXT_COLOR);
2769                        TextInput.maxLength(3);
2770                        TextInput.padding(0);
2771                        TextInput.backgroundColor(this.hasFocusText2 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent);
2772                        TextInput.width('19vp');
2773                        TextInput.height('20vp');
2774                        TextInput.borderRadius(0);
2775                        TextInput.key('DateTextInput2' + this.timeStamp.toString());
2776                        TextInput.onKeyEvent((t9) => {
2777                            this.focusCurrentText(FocusText.TEXT2);
2778                            if (t9.keyCode === CounterConstant.KEYCODE_ESC) {
2779                                this.resetFocusText();
2780                                t9.stopPropagation();
2781                            }
2782                            if (t9.type === KeyType.Down &&
2783                                t9.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) {
2784                                this.subDate();
2785                                this.updateDay();
2786                                t9.stopPropagation();
2787                            }
2788                            if (t9.type === KeyType.Down &&
2789                                t9.keyCode === CounterConstant.KEYCODE_DPAD_UP) {
2790                                this.addDate();
2791                                this.updateDay();
2792                                t9.stopPropagation();
2793                            }
2794                            if (t9.type === KeyType.Down &&
2795                                t9.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
2796                                this.homeFocusText();
2797                                t9.stopPropagation();
2798                            }
2799                            if (t9.type === KeyType.Down &&
2800                                t9.keyCode === CounterConstant.KEYCODE_MOVE_END) {
2801                                this.endFocusText();
2802                                t9.stopPropagation();
2803                            }
2804                            if (t9.type === KeyType.Down &&
2805                                t9.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) {
2806                                this.focusWithTarget('DateTextInput1' + this.timeStamp.toString());
2807                            }
2808                            if (t9.type === KeyType.Down &&
2809                                t9.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) {
2810                                this.focusWithTarget('DateTextInput3' + this.timeStamp.toString());
2811                            }
2812                            if (t9.type === KeyType.Down &&
2813                                t9.keyCode === CounterConstant.KEYCODE_TAB) {
2814                                t9.stopPropagation();
2815                                this.focusWithTarget('DateTextInput1' + this.timeStamp.toString());
2816                            }
2817                        });
2818                        TextInput.onChange((p9) => {
2819                            this.inputMoon = Number(p9);
2820                            if (p9.length !== 2) {
2821                                this.hasInputText2 = true;
2822                            }
2823                            if (p9.length === 3) {
2824                                this.inputMoon = this.inputMoon % 10;
2825                            }
2826                            if (this.timeoutID2 !== -1) {
2827                                clearTimeout(this.timeoutID2);
2828                                this.timeoutID2 = -1;
2829                            }
2830                            this.timeoutID2 = setTimeout(() => {
2831                                this.hasInputText2 = false;
2832                                this.month -= 1;
2833                                if (this.inputMoon >= 1 && this.inputMoon <= 12) {
2834                                    this.month = this.inputMoon;
2835                                }
2836                                else {
2837                                    this.month += 1;
2838                                    this.inputMoon = this.month;
2839                                }
2840                                this.updateDay();
2841                            }, 1000);
2842                            if (p9.length === 2) {
2843                                this.hasInputText2 = false;
2844                                this.month -= 1;
2845                                if (this.inputMoon >= 1 && this.inputMoon <= 12) {
2846                                    this.month = this.inputMoon;
2847                                    let r9 = new DateData(this.year, this.month, this.day);
2848                                    this.onDateChange?.(r9);
2849                                }
2850                                else {
2851                                    this.month += 1;
2852                                    this.inputMoon = this.month;
2853                                }
2854                                this.updateDay();
2855                            }
2856                        });
2857                        TextInput.onSubmit((n9) => {
2858                            if (this.timeoutID2 !== -1) {
2859                                clearTimeout(this.timeoutID2);
2860                                this.timeoutID2 = -1;
2861                            }
2862                            this.hasInputText2 = false;
2863                            this.month -= 1;
2864                            if (this.inputMoon >= 1 && this.inputMoon <= 12) {
2865                                this.month = this.inputMoon;
2866                                this.updateDay();
2867                            }
2868                            else {
2869                                this.month += 1;
2870                            }
2871                        });
2872                        TextInput.focusOnTouch(true);
2873                        TextInput.tabIndex(-1);
2874                        TextInput.focusable(true);
2875                        TextInput.onFocus(() => {
2876                            this.focusText = FocusText.TEXT2;
2877                            this.hasFocusText2 = true;
2878                            this.controller2.caretPosition(this.convertNumberToString(this.month).length);
2879                        });
2880                        TextInput.onBlur(() => {
2881                            this.focusText = FocusText.NONE;
2882                            this.hasFocusText2 = false;
2883                        });
2884                        TextInput.onClick((m9) => {
2885                            this.focusText = FocusText.TEXT2;
2886                            this.hasFocusText2 = true;
2887                            this.controller2.caretPosition(this.convertNumberToString(this.month).length);
2888                        });
2889                    }, TextInput);
2890                    this.observeComponentCreation2((c9, d9) => {
2891                        Text.create('/');
2892                        Text.direction(this.counterDirection);
2893                        Text.textAlign(TextAlign.Center);
2894                        Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE);
2895                        Text.maxFontScale(CounterResource.COUNTER_NUMBER_MAX_FONT_SIZE_SCALE);
2896                        Text.fontColor(CounterResource.COUNTER_TEXT_COLOR);
2897                        Text.width('8vp');
2898                    }, Text);
2899                    Text.pop();
2900                    this.observeComponentCreation2((m8, n8) => {
2901                        TextInput.create({
2902                            text: this.hasInputText3 ? this.inputDay.toString() : this.convertNumberToString(this.day),
2903                            controller: this.controller3
2904                        });
2905                        TextInput.direction(this.counterDirection);
2906                        TextInput.type(InputType.Number);
2907                        TextInput.caretColor(Color.Transparent);
2908                        TextInput.copyOption(CopyOptions.None);
2909                        TextInput.fontSize(this.getTextInputFontSize());
2910                        TextInput.fontWeight(FontWeight.Medium);
2911                        TextInput.fontColor(this.hasFocusText3 ? Color.White : CounterResource.COUNTER_TEXT_COLOR);
2912                        TextInput.maxLength(3);
2913                        TextInput.padding(0);
2914                        TextInput.backgroundColor(this.hasFocusText3 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent);
2915                        TextInput.width('19vp');
2916                        TextInput.height('20vp');
2917                        TextInput.borderRadius(0);
2918                        TextInput.key('DateTextInput3' + this.timeStamp.toString());
2919                        TextInput.onKeyEvent((b9) => {
2920                            this.focusCurrentText(FocusText.TEXT3);
2921                            if (b9.keyCode === CounterConstant.KEYCODE_ESC) {
2922                                this.resetFocusText();
2923                                b9.stopPropagation();
2924                            }
2925                            if (b9.type === KeyType.Down &&
2926                                b9.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) {
2927                                this.subDate();
2928                                b9.stopPropagation();
2929                            }
2930                            if (b9.type === KeyType.Down &&
2931                                b9.keyCode === CounterConstant.KEYCODE_DPAD_UP) {
2932                                this.addDate();
2933                                b9.stopPropagation();
2934                            }
2935                            if (b9.type === KeyType.Down &&
2936                                b9.keyCode === CounterConstant.KEYCODE_MOVE_HOME) {
2937                                this.homeFocusText();
2938                                b9.stopPropagation();
2939                            }
2940                            if (b9.type === KeyType.Down &&
2941                                b9.keyCode === CounterConstant.KEYCODE_MOVE_END) {
2942                                this.endFocusText();
2943                                b9.stopPropagation();
2944                            }
2945                            if (b9.type === KeyType.Down &&
2946                                b9.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) {
2947                                this.focusWithTarget('DateTextInput2' + this.timeStamp.toString());
2948                            }
2949                            if (b9.type === KeyType.Down &&
2950                                b9.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) {
2951                                this.focusWithTarget('DateTextInput3' + this.timeStamp.toString());
2952                                b9.stopPropagation();
2953                            }
2954                            if (b9.type === KeyType.Down &&
2955                                b9.keyCode === CounterConstant.KEYCODE_TAB) {
2956                                b9.stopPropagation();
2957                                this.focusWithTarget('DateTextInput1' + this.timeStamp.toString());
2958                            }
2959                        });
2960                        TextInput.onChange((x8) => {
2961                            this.inputDay = Number(x8);
2962                            if (x8.length !== 2) {
2963                                this.hasInputText3 = true;
2964                            }
2965                            if (x8.length === 3) {
2966                                this.inputDay = this.inputDay % 10;
2967                            }
2968                            if (this.timeoutID3 !== -1) {
2969                                clearTimeout(this.timeoutID3);
2970                                this.timeoutID3 = -1;
2971                            }
2972                            this.timeoutID3 = setTimeout(() => {
2973                                this.hasInputText3 = false;
2974                                this.day -= 1;
2975                                if (this.inputDay >= 1 && this.inputDay <= this.getDayNumber()) {
2976                                    this.day = this.inputDay;
2977                                }
2978                                else {
2979                                    this.day += 1;
2980                                    this.inputDay = this.day;
2981                                }
2982                            }, 1000);
2983                            if (x8.length === 2) {
2984                                this.hasInputText3 = false;
2985                                this.day -= 1;
2986                                if (this.inputDay >= 1 && this.inputDay <= this.getDayNumber()) {
2987                                    this.day = this.inputDay;
2988                                    let z8 = new DateData(this.year, this.month, this.day);
2989                                    this.onDateChange?.(z8);
2990                                }
2991                                else {
2992                                    this.day += 1;
2993                                    this.inputDay = this.day;
2994                                }
2995                            }
2996                        });
2997                        TextInput.onSubmit((v8) => {
2998                            if (this.timeoutID3 !== -1) {
2999                                clearTimeout(this.timeoutID3);
3000                                this.timeoutID3 = -1;
3001                            }
3002                            this.hasInputText3 = false;
3003                            this.day -= 1;
3004                            if (this.inputDay >= 1 && this.inputDay <= this.getDayNumber()) {
3005                                this.day = this.inputDay;
3006                            }
3007                            else {
3008                                this.day += 1;
3009                            }
3010                        });
3011                        TextInput.tabIndex(-2);
3012                        TextInput.focusOnTouch(true);
3013                        TextInput.focusable(true);
3014                        TextInput.onFocus(() => {
3015                            this.focusText = FocusText.TEXT3;
3016                            this.hasFocusText3 = true;
3017                            this.controller3.caretPosition(this.convertNumberToString(this.day).length);
3018                        });
3019                        TextInput.onBlur(() => {
3020                            this.focusText = FocusText.NONE;
3021                            this.hasFocusText3 = false;
3022                        });
3023                        TextInput.onClick((u8) => {
3024                            this.focusText = FocusText.TEXT3;
3025                            this.hasFocusText3 = true;
3026                            this.controller3.caretPosition(this.convertNumberToString(this.day).length);
3027                        });
3028                    }, TextInput);
3029                    Row.pop();
3030                    this.observeComponentCreation2((k8, l8) => {
3031                        Column.create();
3032                        Column.direction(this.counterDirection);
3033                        Column.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
3034                        Column.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT);
3035                        Column.borderWidth({ start: LengthMetrics.vp(CounterResource.COUNTER_BORDER_WIDTH_NUMBER) });
3036                        Column.borderColor(CounterResource.COUNTER_BORDER_COLOR);
3037                    }, Column);
3038                    this.observeComponentCreation2((i8, j8) => {
3039                        Stack.create();
3040                        Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
3041                        Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
3042                        Stack.padding({ top: '1vp' });
3043                        Stack.borderWidth({ bottom: '1vp' });
3044                        Stack.borderColor(CounterResource.COUNTER_BORDER_COLOR);
3045                        Stack.clip(true);
3046                    }, Stack);
3047                    this.observeComponentCreation2((g8, h8) => {
3048                        Rect.create();
3049                        Rect.direction(this.counterDirection);
3050                        Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH);
3051                        Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT);
3052                        Rect.radius([
3053                            ['0vp', '0vp'],
3054                            [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS],
3055                            ['0vp', '0vp'],
3056                            ['0vp', '0vp']
3057                        ]);
3058                        Rect.strokeWidth(this.addBtnFocusWidh);
3059                        Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
3060                        Rect.margin({ end: LengthMetrics.vp(1) });
3061                        Rect.fillOpacity(0);
3062                    }, Rect);
3063                    this.observeComponentCreation2((e8, f8) => {
3064                        Image.create(CounterResource.BUTTON_ARROW_UP);
3065                        Image.direction(this.counterDirection);
3066                        Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH);
3067                        Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT);
3068                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
3069                        Image.opacity(this.addOpacity);
3070                    }, Image);
3071                    this.observeComponentCreation2((s7, t7) => {
3072                        Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.addBtnStateEffect });
3073                        Button.direction(this.counterDirection);
3074                        Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
3075                        Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
3076                        Button.backgroundColor(Color.Transparent);
3077                        Button.opacity(this.addOpacity);
3078                        Button.enabled(this.addBtnEnabled);
3079                        Button.onClick((c8) => {
3080                            this.addDate();
3081                            if (c8.source === SourceType.Mouse ||
3082                                c8.source === SourceType.TouchScreen) {
3083                                this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
3084                            }
3085                        });
3086                        Gesture.create(GesturePriority.Low);
3087                        LongPressGesture.create({ repeat: true });
3088                        LongPressGesture.onAction((a8) => {
3089                            if (a8.repeat) {
3090                                this.addDate();
3091                            }
3092                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
3093                        });
3094                        LongPressGesture.pop();
3095                        Gesture.pop();
3096                        Button.hoverEffect(this.choverEffect);
3097                        Button.onHover((z7) => {
3098                            this.onHoverIncrease && this.onHoverIncrease(z7);
3099                        });
3100                        Button.focusable(false);
3101                        Button.onFocus(() => {
3102                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
3103                            this.onFocusIncrease && this.onFocusIncrease();
3104                        });
3105                        Button.onBlur(() => {
3106                            this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
3107                            this.onBlurIncrease && this.onBlurIncrease();
3108                        });
3109                    }, Button);
3110                    Button.pop();
3111                    Stack.pop();
3112                    this.observeComponentCreation2((q7, r7) => {
3113                        Stack.create();
3114                        Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
3115                        Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
3116                        Stack.clip(true);
3117                    }, Stack);
3118                    this.observeComponentCreation2((o7, p7) => {
3119                        Rect.create();
3120                        Rect.direction(this.counterDirection);
3121                        Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH);
3122                        Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT);
3123                        Rect.radius([
3124                            ['0vp', '0vp'],
3125                            ['0vp', '0vp'],
3126                            [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS],
3127                            ['0vp', '0vp']
3128                        ]);
3129                        Rect.strokeWidth(this.subBtnFocusWidh);
3130                        Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR);
3131                        Rect.margin({
3132                            top: LengthMetrics.vp(1),
3133                            end: LengthMetrics.vp(1),
3134                            bottom: LengthMetrics.vp(2)
3135                        });
3136                        Rect.fillOpacity(0);
3137                    }, Rect);
3138                    this.observeComponentCreation2((m7, n7) => {
3139                        Image.create(CounterResource.BUTTON_ARROW_DOWN);
3140                        Image.direction(this.counterDirection);
3141                        Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH);
3142                        Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT);
3143                        Image.fillColor(CounterResource.BUTTON_ICON_COLOR);
3144                        Image.opacity(this.subOpacity);
3145                    }, Image);
3146                    this.observeComponentCreation2((a7, b7) => {
3147                        Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.subBtnStateEffect });
3148                        Button.direction(this.counterDirection);
3149                        Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH);
3150                        Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT);
3151                        Button.backgroundColor(Color.Transparent);
3152                        Button.opacity(this.subOpacity);
3153                        Button.enabled(this.subBtnEnabled);
3154                        Button.onClick((k7) => {
3155                            this.subDate();
3156                            if (k7.source === SourceType.Mouse ||
3157                                k7.source === SourceType.TouchScreen) {
3158                                this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
3159                            }
3160                        });
3161                        Gesture.create(GesturePriority.Low);
3162                        LongPressGesture.create({ repeat: true });
3163                        LongPressGesture.onAction((i7) => {
3164                            if (i7.repeat) {
3165                                this.subDate();
3166                            }
3167                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
3168                        });
3169                        LongPressGesture.pop();
3170                        Gesture.pop();
3171                        Button.hoverEffect(this.choverEffect);
3172                        Button.onHover((h7) => {
3173                            this.onHoverDecrease && this.onHoverDecrease(h7);
3174                        });
3175                        Button.focusable(false);
3176                        Button.onFocus(() => {
3177                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH;
3178                            this.onFocusDecrease && this.onFocusDecrease();
3179                        });
3180                        Button.onBlur(() => {
3181                            this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH;
3182                            this.onBlurDecrease && this.onBlurDecrease();
3183                        });
3184                    }, Button);
3185                    Button.pop();
3186                    Stack.pop();
3187                    Column.pop();
3188                    Row.pop();
3189                });
3190            }
3191            else {
3192                this.ifElseBranchUpdateFunction(4, () => {
3193                });
3194            }
3195        }, If);
3196        If.pop();
3197    }
3198
3199    rerender() {
3200        this.updateDirtyElements();
3201    }
3202}
3203
3204export default {CounterType, CommonOptions, InlineStyleOptions, NumberStyleOptions,
3205    DateData, DateStyleOptions, CounterOptions, CounterComponent};
3206