import type webview from "@ohos:web.webview";
import type common from "@ohos:app.ability.common";
import type { TencentQianWebViewConfig } from './model/TencentQianWebViewConfig';
import type { OnSignResult, OnSdkEvent } from './model/SignCallback';
import { PageStartedEvent, PageFinishedEvent, PermissionGrantedEvent, PermissionDeniedEvent, LoadErrorEvent, HttpErrorEvent, SslErrorEvent, RenderProcessGoneEvent } from "@normalized:N&&&tencentqianwebview/src/main/ets/model/SdkEvent&1.0.0";
import { WebSettingsApplier } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/WebSettingsApplier&1.0.0";
import type { WebSettingsSnapshot } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/WebSettingsApplier&1.0.0";
import { UserAgentInjector } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/UserAgentInjector&1.0.0";
import { CookieManagerHelper } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/CookieManagerHelper&1.0.0";
import { JsDialogHandler } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/JsDialogHandler&1.0.0";
import { DownloadHandler } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/DownloadHandler&1.0.0";
import { NetworkStateInjector } from "@normalized:N&&&tencentqianwebview/src/main/ets/internal/NetworkStateInjector&1.0.0";
import { FileChooserHandler } from "@normalized:N&&&tencentqianwebview/src/main/ets/filechooser/FileChooserHandler&1.0.0";
import { RuntimePermissionRequester } from "@normalized:N&&&tencentqianwebview/src/main/ets/permission/RuntimePermissionRequester&1.0.0";
import { SchemeInterceptor } from "@normalized:N&&&tencentqianwebview/src/main/ets/scheme/SchemeInterceptor&1.0.0";
class BjcCov {
    coverage: {
        [key: string]: string | number;
    };
    constructor(covData: object) {
        const gcv = "__coverage__";
        let coverage = globalThis[gcv] || (globalThis[gcv] = {});
        if (!coverage[covData.path] && true) {
            coverage[covData.path] = covData;
        }
        this.coverage = coverage[covData.path];
    }
    instrumentFunction(func: number) {
        this.coverage.functions[func].count++;
        this.coverage.functions[func].regions[0].count++;
    }
    instrumentRegion(func: number, region: number) {
        this.coverage.functions[func].regions[region].count++;
    }
    instrumentReturn(func: number, retIdx: number) {
        this.coverage.functions[func].returnes[retIdx].count++;
    }
    instrumentBranch(func: number, branch: number, trueOrFalse: boolean) {
        if (trueOrFalse) {
            this.coverage.functions[func].branches[branch].trueCount++;
            for (let r of Object.values(this.coverage.functions[func].branches[branch].group)) {
                if (r !== branch) {
                    this.coverage.functions[func].branches[r as number].falseCount++;
                }
            }
        }
        else {
            this.coverage.functions[func].branches[branch].falseCount++;
        }
    }
}
let bjccovms5u83kk = new BjcCov({ version: "bjc v1.0.0", versionCode: 10000, path: "tencentqianwebview/src/main/ets/TencentQianWebViewConfigurator.ets", hash: "6db9a765200917b9114127103791745f0368765d477da27a39b61a32bd3377ca", lineCnt: 443, count: 0, projectPath: "", functions: { 0: { name: "anonymous_0", count: 0, regions: { 0: { startLoc: { line: 46, col: 18 }, endLoc: { line: 46, col: 30 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 0 }, 1: { name: "anonymous_1", count: 0, regions: { 0: { startLoc: { line: 47, col: 16 }, endLoc: { line: 47, col: 29 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 1 }, 2: { name: "anonymous_2", count: 0, regions: { 0: { startLoc: { line: 59, col: 14 }, endLoc: { line: 59, col: 26 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 2 }, 3: { name: "anonymous_3", count: 0, regions: { 0: { startLoc: { line: 60, col: 26 }, endLoc: { line: 60, col: 40 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 3 }, 4: { name: "anonymous_4", count: 0, regions: { 0: { startLoc: { line: 61, col: 10 }, endLoc: { line: 61, col: 39 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 4 }, 5: { name: "anonymous_5", count: 0, regions: { 0: { startLoc: { line: 62, col: 9 }, endLoc: { line: 62, col: 19 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 5 }, 6: { name: "anonymous_6", count: 0, regions: { 0: { startLoc: { line: 71, col: 19 }, endLoc: { line: 71, col: 43 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 6 }, 7: { name: "anonymous_7", count: 0, regions: { 0: { startLoc: { line: 75, col: 18 }, endLoc: { line: 75, col: 32 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 7 }, 8: { name: "anonymous_8", count: 0, regions: { 0: { startLoc: { line: 76, col: 14 }, endLoc: { line: 76, col: 27 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 8 }, 9: { name: "anonymous_9", count: 0, regions: { 0: { startLoc: { line: 77, col: 12 }, endLoc: { line: 77, col: 24 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 9 }, 10: { name: "anonymous_10", count: 0, regions: { 0: { startLoc: { line: 98, col: 24 }, endLoc: { line: 98, col: 48 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 10 }, 11: { name: "anonymous_11", count: 0, regions: { 0: { startLoc: { line: 99, col: 18 }, endLoc: { line: 99, col: 28 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 11 }, 12: { name: "anonymous_12", count: 0, regions: { 0: { startLoc: { line: 100, col: 17 }, endLoc: { line: 100, col: 27 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 12 }, 13: { name: "anonymous_13", count: 0, regions: { 0: { startLoc: { line: 104, col: 18 }, endLoc: { line: 104, col: 28 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 13 }, 14: { name: "anonymous_14", count: 0, regions: { 0: { startLoc: { line: 105, col: 17 }, endLoc: { line: 105, col: 27 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 14 }, 15: { name: "anonymous_15", count: 0, regions: { 0: { startLoc: { line: 127, col: 18 }, endLoc: { line: 127, col: 30 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 15 }, 16: { name: "anonymous_16", count: 0, regions: { 0: { startLoc: { line: 128, col: 16 }, endLoc: { line: 128, col: 29 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 16 }, 17: { name: "anonymous_17", count: 0, regions: { 0: { startLoc: { line: 132, col: 17 }, endLoc: { line: 132, col: 29 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 17 }, 18: { name: "anonymous_18", count: 0, regions: { 0: { startLoc: { line: 133, col: 17 }, endLoc: { line: 133, col: 29 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 18 }, 19: { name: "anonymous_19", count: 0, regions: { 0: { startLoc: { line: 137, col: 20 }, endLoc: { line: 137, col: 32 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 19 }, 20: { name: "anonymous_20", count: 0, regions: { 0: { startLoc: { line: 138, col: 21 }, endLoc: { line: 138, col: 33 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 20 }, 21: { name: "anonymous_21", count: 0, regions: { 0: { startLoc: { line: 147, col: 17 }, endLoc: { line: 147, col: 27 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 21 }, 22: { name: "anonymous_22", count: 0, regions: { 0: { startLoc: { line: 176, col: 25 }, endLoc: { line: 176, col: 35 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 22 }, 23: { name: "anonymous_23", count: 0, regions: { 0: { startLoc: { line: 178, col: 20 }, endLoc: { line: 178, col: 48 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 23 }, 24: { name: "anonymous_24", count: 0, regions: { 0: { startLoc: { line: 180, col: 16 }, endLoc: { line: 180, col: 41 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 24 }, 25: { name: "anonymous_25", count: 0, regions: { 0: { startLoc: { line: 182, col: 14 }, endLoc: { line: 182, col: 39 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 25 }, 26: { name: "anonymous_26", count: 0, regions: { 0: { startLoc: { line: 184, col: 24 }, endLoc: { line: 184, col: 49 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 26 }, 27: { name: "anonymous_27", count: 0, regions: { 0: { startLoc: { line: 186, col: 23 }, endLoc: { line: 186, col: 51 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 27 }, 28: { name: "anonymous_28", count: 0, regions: { 0: { startLoc: { line: 188, col: 12 }, endLoc: { line: 188, col: 40 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 28 }, 29: { name: "anonymous_29", count: 0, regions: { 0: { startLoc: { line: 190, col: 14 }, endLoc: { line: 190, col: 42 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 29 }, 30: { name: "anonymous_30", count: 0, regions: { 0: { startLoc: { line: 192, col: 13 }, endLoc: { line: 192, col: 41 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 30 }, 31: { name: "anonymous_31", count: 0, regions: { 0: { startLoc: { line: 194, col: 20 }, endLoc: { line: 194, col: 45 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 31 }, 32: { name: "anonymous_32", count: 0, regions: { 0: { startLoc: { line: 196, col: 19 }, endLoc: { line: 196, col: 44 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 32 }, 33: { name: "anonymous_33", count: 0, regions: { 0: { startLoc: { line: 198, col: 23 }, endLoc: { line: 198, col: 48 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 33 }, 34: { name: "anonymous_34", count: 0, regions: { 0: { startLoc: { line: 200, col: 27 }, endLoc: { line: 200, col: 52 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 34 }, 35: { name: "anonymous_35", count: 0, regions: { 0: { startLoc: { line: 202, col: 19 }, endLoc: { line: 202, col: 44 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 35 }, 36: { name: "anonymous_36", count: 0, regions: { 0: { startLoc: { line: 204, col: 21 }, endLoc: { line: 204, col: 46 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 36 }, 37: { name: "apply", count: 0, regions: { 0: { startLoc: { line: 227, col: 3 }, endLoc: { line: 438, col: 4 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 234, col: 5 }, endLoc: { line: 438, col: 4 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 262, col: 9 }, endLoc: { line: 263, col: 8 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 272, col: 11 }, endLoc: { line: 273, col: 10 }, count: 0, ignored: 0 }, 4: { startLoc: { line: 281, col: 11 }, endLoc: { line: 282, col: 10 }, count: 0, ignored: 0 }, 5: { startLoc: { line: 288, col: 11 }, endLoc: { line: 289, col: 10 }, count: 0, ignored: 0 }, 6: { startLoc: { line: 310, col: 9 }, endLoc: { line: 318, col: 8 }, count: 0, ignored: 0 }, 7: { startLoc: { line: 306, col: 11 }, endLoc: { line: 308, col: 10 }, count: 0, ignored: 0 }, 8: { startLoc: { line: 315, col: 11 }, endLoc: { line: 317, col: 10 }, count: 0, ignored: 0 }, 9: { startLoc: { line: 313, col: 13 }, endLoc: { line: 314, col: 12 }, count: 0, ignored: 0 }, 10: { startLoc: { line: 322, col: 9 }, endLoc: { line: 337, col: 8 }, count: 0, ignored: 0 }, 11: { startLoc: { line: 341, col: 9 }, endLoc: { line: 345, col: 8 }, count: 0, ignored: 0 }, 12: { startLoc: { line: 349, col: 9 }, endLoc: { line: 357, col: 8 }, count: 0, ignored: 0 }, 13: { startLoc: { line: 361, col: 9 }, endLoc: { line: 370, col: 8 }, count: 0, ignored: 0 }, 14: { startLoc: { line: 374, col: 9 }, endLoc: { line: 382, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 37 }, 38: { name: "anonymous_37", count: 0, regions: { 0: { startLoc: { line: 242, col: 7 }, endLoc: { line: 244, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 243, col: 9 }, endLoc: { line: 244, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 38 }, 39: { name: "anonymous_38", count: 0, regions: { 0: { startLoc: { line: 260, col: 29 }, endLoc: { line: 263, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 39 }, 40: { name: "anonymous_39", count: 0, regions: { 0: { startLoc: { line: 265, col: 24 }, endLoc: { line: 276, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 266, col: 13 }, endLoc: { line: 273, col: 10 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 273, col: 11 }, endLoc: { line: 275, col: 10 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 269, col: 38 }, endLoc: { line: 271, col: 12 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 269, col: 15 }, endLoc: { line: 269, col: 36 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 40 }, 41: { name: "anonymous_40", count: 0, regions: { 0: { startLoc: { line: 278, col: 20 }, endLoc: { line: 283, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 279, col: 39 }, endLoc: { line: 282, col: 10 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 279, col: 13 }, endLoc: { line: 279, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 41 }, 42: { name: "anonymous_41", count: 0, regions: { 0: { startLoc: { line: 285, col: 18 }, endLoc: { line: 290, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 286, col: 39 }, endLoc: { line: 289, col: 10 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 286, col: 13 }, endLoc: { line: 286, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 42 }, 43: { name: "anonymous_42", count: 0, regions: { 0: { startLoc: { line: 292, col: 28 }, endLoc: { line: 318, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 304, col: 33 }, endLoc: { line: 308, col: 10 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 304, col: 13 }, endLoc: { line: 304, col: 31 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 43 }, 44: { name: "anonymous_43", count: 0, regions: { 0: { startLoc: { line: 298, col: 22 }, endLoc: { line: 302, col: 10 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 299, col: 41 }, endLoc: { line: 301, col: 12 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 299, col: 15 }, endLoc: { line: 299, col: 39 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 44 }, 45: { name: "anonymous_44", count: 0, regions: { 0: { startLoc: { line: 310, col: 77 }, endLoc: { line: 317, col: 10 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 311, col: 25 }, endLoc: { line: 314, col: 12 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 311, col: 15 }, endLoc: { line: 311, col: 23 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 45 }, 46: { name: "anonymous_45", count: 0, regions: { 0: { startLoc: { line: 320, col: 27 }, endLoc: { line: 337, col: 8 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 331, col: 11 }, endLoc: { line: 331, col: 45 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 46 }, 47: { name: "anonymous_46", count: 0, regions: { 0: { startLoc: { line: 332, col: 16 }, endLoc: { line: 334, col: 10 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 333, col: 11 }, endLoc: { line: 334, col: 10 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 47 }, 48: { name: "anonymous_47", count: 0, regions: { 0: { startLoc: { line: 339, col: 16 }, endLoc: { line: 345, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 48 }, 49: { name: "anonymous_48", count: 0, regions: { 0: { startLoc: { line: 341, col: 67 }, endLoc: { line: 343, col: 10 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 342, col: 11 }, endLoc: { line: 343, col: 10 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 49 }, 50: { name: "anonymous_49", count: 0, regions: { 0: { startLoc: { line: 347, col: 18 }, endLoc: { line: 357, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 50 }, 51: { name: "anonymous_50", count: 0, regions: { 0: { startLoc: { line: 349, col: 69 }, endLoc: { line: 355, col: 10 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 350, col: 19 }, endLoc: { line: 352, col: 12 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 352, col: 18 }, endLoc: { line: 354, col: 12 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 350, col: 15 }, endLoc: { line: 350, col: 17 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 51 }, 52: { name: "anonymous_51", count: 0, regions: { 0: { startLoc: { line: 359, col: 17 }, endLoc: { line: 370, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 52 }, 53: { name: "anonymous_52", count: 0, regions: { 0: { startLoc: { line: 361, col: 77 }, endLoc: { line: 368, col: 10 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 362, col: 31 }, endLoc: { line: 364, col: 12 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 364, col: 18 }, endLoc: { line: 367, col: 12 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 362, col: 15 }, endLoc: { line: 362, col: 29 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 53 }, 54: { name: "anonymous_53", count: 0, regions: { 0: { startLoc: { line: 372, col: 24 }, endLoc: { line: 382, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 54 }, 55: { name: "anonymous_54", count: 0, regions: { 0: { startLoc: { line: 384, col: 23 }, endLoc: { line: 396, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 386, col: 39 }, endLoc: { line: 388, col: 10 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 389, col: 39 }, endLoc: { line: 395, col: 10 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 386, col: 13 }, endLoc: { line: 386, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 389, col: 13 }, endLoc: { line: 389, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 55 }, 56: { name: "anonymous_55", count: 0, regions: { 0: { startLoc: { line: 398, col: 27 }, endLoc: { line: 410, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 400, col: 39 }, endLoc: { line: 402, col: 10 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 403, col: 39 }, endLoc: { line: 409, col: 10 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 400, col: 13 }, endLoc: { line: 400, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 }, 1: { startLoc: { line: 403, col: 13 }, endLoc: { line: 403, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 56 }, 57: { name: "anonymous_56", count: 0, regions: { 0: { startLoc: { line: 412, col: 31 }, endLoc: { line: 422, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 414, col: 13 }, endLoc: { line: 416, col: 10 }, count: 0, ignored: 0 }, 2: { startLoc: { line: 416, col: 11 }, endLoc: { line: 418, col: 10 }, count: 0, ignored: 0 }, 3: { startLoc: { line: 419, col: 39 }, endLoc: { line: 421, col: 10 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 419, col: 13 }, endLoc: { line: 419, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 57 }, 58: { name: "anonymous_57", count: 0, regions: { 0: { startLoc: { line: 424, col: 23 }, endLoc: { line: 430, col: 8 }, count: 0, ignored: 0 }, 1: { startLoc: { line: 427, col: 39 }, endLoc: { line: 429, col: 10 }, count: 0, ignored: 0 } }, branches: { 0: { startLoc: { line: 427, col: 13 }, endLoc: { line: 427, col: 37 }, trueCount: 0, falseCount: 0, group: {}, ignored: 0 } }, ignored: 0, index: 58 }, 59: { name: "anonymous_58", count: 0, regions: { 0: { startLoc: { line: 432, col: 25 }, endLoc: { line: 434, col: 8 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 59 }, 60: { name: "TencentQianWebViewConfigurator.constructor", count: 0, regions: { 0: { startLoc: { line: 441, col: 3 }, endLoc: { line: 441, col: 27 }, count: 0, ignored: 0 } }, branches: {}, ignored: 0, index: 60 } }, exeLine: { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 7, 7: 8, 8: 9, 9: 10, 10: 11, 11: 12, 12: 13, 13: 14, 14: 15, 15: 16, 16: 17, 17: 18, 18: 19, 19: 20, 20: 21, 21: 22, 22: 23, 23: 29, 24: 30, 25: 31, 26: 41, 27: 42, 28: 45, 29: 46, 30: 47, 31: 50, 32: 51, 33: 54, 34: 55, 35: 58, 36: 59, 37: 60, 38: 61, 39: 62, 40: 65, 41: 66, 42: 67, 43: 70, 44: 71, 45: 74, 46: 75, 47: 76, 48: 77, 49: 80, 50: 81, 51: 82, 52: 83, 53: 90, 54: 91, 55: 92, 56: 93, 57: 94, 58: 97, 59: 98, 60: 99, 61: 100, 62: 103, 63: 104, 64: 105, 65: 108, 66: 109, 67: 110, 68: 111, 69: 112, 70: 113, 71: 116, 72: 117, 73: 118, 74: 121, 75: 122, 76: 123, 77: 126, 78: 127, 79: 128, 80: 131, 81: 132, 82: 133, 83: 136, 84: 137, 85: 138, 86: 141, 87: 142, 88: 143, 89: 146, 90: 147, 91: 150, 92: 151, 93: 154, 94: 155, 95: 166, 96: 168, 97: 170, 98: 172, 99: 174, 100: 176, 101: 178, 102: 180, 103: 182, 104: 184, 105: 186, 106: 188, 107: 190, 108: 192, 109: 194, 110: 196, 111: 198, 112: 200, 113: 202, 114: 204, 115: 216, 116: 227, 117: 228, 118: 229, 119: 230, 120: 231, 121: 232, 122: 233, 123: 234, 124: 237, 125: 238, 126: 239, 127: 240, 128: 241, 129: 242, 130: 243, 131: 248, 132: 249, 133: 251, 134: 253, 135: 254, 136: 255, 137: 257, 138: 258, 139: 260, 140: 261, 141: 262, 142: 265, 143: 266, 144: 267, 145: 268, 146: 269, 147: 270, 148: 272, 149: 273, 150: 274, 151: 278, 152: 279, 153: 280, 154: 281, 155: 285, 156: 286, 157: 287, 158: 288, 159: 292, 160: 293, 161: 294, 162: 295, 163: 296, 164: 298, 165: 299, 166: 300, 167: 304, 168: 305, 169: 306, 170: 307, 171: 310, 172: 311, 173: 312, 174: 313, 175: 315, 176: 316, 177: 320, 178: 321, 179: 322, 180: 323, 181: 324, 182: 325, 183: 327, 184: 328, 185: 329, 186: 330, 187: 331, 188: 332, 189: 333, 190: 336, 191: 339, 192: 340, 193: 341, 194: 342, 195: 344, 196: 347, 197: 348, 198: 349, 199: 350, 200: 351, 201: 352, 202: 353, 203: 356, 204: 359, 205: 360, 206: 361, 207: 362, 208: 363, 209: 364, 210: 366, 211: 369, 212: 372, 213: 373, 214: 374, 215: 375, 216: 376, 217: 377, 218: 378, 219: 379, 220: 380, 221: 384, 222: 385, 223: 386, 224: 387, 225: 389, 226: 390, 227: 391, 228: 392, 229: 393, 230: 398, 231: 399, 232: 400, 233: 401, 234: 403, 235: 404, 236: 405, 237: 406, 238: 407, 239: 412, 240: 413, 241: 414, 242: 415, 243: 416, 244: 419, 245: 420, 246: 424, 247: 425, 248: 426, 249: 427, 250: 428, 251: 432, 252: 437, 253: 441 } });
/**
 * `javaScriptOnDocumentStart` 入参契约。@ohos.web.webview 未公开导出 ScriptItem 类型,
 * 这里以最小子集声明,与 ArkUI 内置 ScriptItem 结构等价。
 */
export interface ScriptItemLike {
    script: string;
    scriptRules: string[];
}
/**
 * ArkWeb 回调入参的最小契约接口集合。
 *
 * ArkTS 严格模式禁止使用对象字面量作为类型声明,所有匿名 `{ ... }` 类型必须先声明为命名 interface。
 * 由于 @ohos.web.webview 没有公开导出每个回调的入参类型,这里以最小子集声明,
 * 实际运行时 ArkWeb 传入的对象只要包含这些字段即可工作。
 */
export interface OnLoadInterceptEvent {
    data: OnLoadInterceptData;
}
export interface OnLoadInterceptData {
    getRequestUrl: () => string;
    isMainFrame: () => boolean;
}
export interface OnPageEvent {
    url: string;
}
export interface OnPermissionRequestEvent {
    request: PermissionRequestLike;
}
export interface PermissionRequestLike {
    getOrigin: () => string;
    getAccessibleResource: () => string[];
    grant: (resources: string[]) => void;
    deny: () => void;
}
export interface OnShowFileSelectorEvent {
    result: FileSelectorResultLike;
    fileSelector: FileSelectorParamLike;
}
export interface FileSelectorResultLike {
    handleFileList: (uris: string[]) => void;
}
export interface FileSelectorParamLike {
    getAcceptType: () => string[];
    isCapture: () => boolean;
    getMode: () => number;
}
export interface OnJsDialogEvent {
    url: string;
    message: string;
    result: JsResultLike;
}
/**
 * `onPrompt` 事件入参。与 onAlert/onConfirm 不同,prompt 多出一个 `value` 默认值,
 * 并且 `result` 需调 `handlePromptConfirm(value)` 返回用户输入。
 */
export interface OnJsPromptEvent {
    url: string;
    message: string;
    value: string;
    result: JsPromptResultLike;
}
export interface JsPromptResultLike {
    handlePromptConfirm: (result: string) => void;
    handleConfirm: () => void;
    handleCancel: () => void;
}
export interface JsResultLike {
    handleConfirm: () => void;
    handleCancel: () => void;
}
export interface OnDownloadStartEvent {
    url: string;
    userAgent: string;
    contentDisposition: string;
    mimetype: string;
    contentLength: number;
}
export interface OnErrorReceiveEvent {
    request: WebRequestLike;
    error: WebResourceErrorLike;
}
export interface OnHttpErrorReceiveEvent {
    request: WebRequestLike;
    response: WebResourceResponseLike;
}
export interface WebRequestLike {
    getRequestUrl: () => string;
    isMainFrame: () => boolean;
}
export interface WebResourceErrorLike {
    getErrorCode: () => number;
    getErrorInfo: () => string;
}
export interface WebResourceResponseLike {
    getResponseCode: () => number;
    getReasonMessage: () => string;
}
export interface OnSslErrorEvent {
    handler: SslErrorHandlerLike;
    error: number;
}
export interface SslErrorHandlerLike {
    handleCancel: () => void;
}
export interface OnRenderExitedEvent {
    renderExitReason: number;
}
export interface OnProgressChangeEvent {
    newProgress: number;
}
/**
 * 由 Configurator 返回给客户的事件处理器集合。
 * 客户把这些处理器逐个绑定到自己 Web 组件的对应回调即可获得 SDK 全部能力。
 *
 * 所有事件回调入参类型为 `ESObject`(等价 any),用于绕过 ArkTS
 * `arkts-no-structural-typing` 限制 —— ArkUI Web 回调对象无法与
 * 我们的 `OnXxxEvent` interface 做结构性匹配,在 handler 内部再按字段取用。
 */
export interface TencentQianWebViewHandlers {
    /** Web 组件的标准能力开关(JS / DomStorage / 缩放等),客户绑到链式属性上。 */
    webSettings: Readonly<WebSettingsSnapshot>;
    /** 内容混合模式名称: `'All'` 允许 https 页面加载 http 资源,`'None'` 禁止。 */
    mixedMode: 'All' | 'None';
    /** document_start 注入脚本集合,客户绑定到 `.javaScriptOnDocumentStart(scripts)`。 */
    documentStartScripts: Array<ScriptItemLike>;
    /** 网络状态注入器,客户在 `onControllerAttached` 中调 `attach(controller)`。 */
    networkStateInjector: NetworkStateInjector;
    /** controller attach 时机回调。客户在 Web 组件 `.onControllerAttached(...)` 中转调。 */
    onControllerAttached: () => void;
    /** URL 拦截。返回 `true` = 取消导航(如命中外部 scheme 或 `qianapp://`)。 */
    onLoadIntercept: (event: any) => boolean;
    /** 页面开始加载。 */
    onPageBegin: (event: any) => void;
    /** 页面加载结束。 */
    onPageEnd: (event: any) => void;
    /** Web 端权限请求(摄像头 / 麦克风 / 定位等)。 */
    onPermissionRequest: (event: any) => void;
    /** `<input type=file>` 文件选择。返回 `true` 表示由 SDK 接管。 */
    onShowFileSelector: (event: any) => boolean;
    /** JS `alert`。返回 `true` 表示由 SDK 接管,弹出原生对话框。 */
    onAlert: (event: any) => boolean;
    /** JS `confirm`。返回 `true` 表示由 SDK 接管,弹出原生对话框。 */
    onConfirm: (event: any) => boolean;
    /** JS `prompt`。**必须返回 `true`**,否则 ArkWeb 默认拦截并返回 null。 */
    onPrompt: (event: any) => boolean;
    /** 文件下载。SDK 走系统下载并通过 `onSdkEvent` 上报进度/结果。 */
    onDownloadStart: (event: any) => void;
    /** 资源加载错误。 */
    onErrorReceive: (event: any) => void;
    /** HTTP 错误响应(4xx / 5xx)。 */
    onHttpErrorReceive: (event: any) => void;
    /** SSL 证书错误。SDK 默认全部 cancel,避免 MITM 风险。 */
    onSslErrorEventReceive: (event: any) => void;
    /** 渲染进程退出。客户需自行决定 reload 或关闭页面。 */
    onRenderExited: (event: any) => void;
    /** 加载进度变化。客户可在容器外侧绑定进度条 UI。 */
    onProgressChange: (event: any) => void;
}
/**
 * 配置模式工具类(三种集成方式中的最灵活方式)。
 *
 * 客户已经有自己的 `Web` 组件 + `WebviewController` 实例,只想叠加 SDK 能力
 * (UA 注入、scheme 拦截、权限处理、文件选择、JS 弹窗、下载、错误事件等)
 * 而不替换原有 Web 组件时,使用本类。
 *
 * 调用 `apply()` 得到一组事件处理器,逐个绑定到自有 Web 组件的对应回调即可。
 */
export class TencentQianWebViewConfigurator {
    /**
     * 把 SDK 能力叠加到客户已有的 WebviewController 上,返回事件处理器集合。
     *
     * @param controller 客户自己创建的 WebviewController(SDK 不替换、不重建)
     * @param context UIAbilityContext
     * @param config 容器配置
     * @param onSignResult 签署结果回调(必填)
     * @param onSdkEvent SDK 事件回调(可选,用于日志/埋点)
     * @returns handlers 集合,客户绑定到自己的 Web 组件回调
     */
    public static apply(controller: webview.WebviewController, context: common.UIAbilityContext, config: TencentQianWebViewConfig, onSignResult: OnSignResult, onSdkEvent?: OnSdkEvent): TencentQianWebViewHandlers {
        bjccovms5u83kk.instrumentFunction(37);
        bjccovms5u83kk.instrumentRegion(37, 1);
        CookieManagerHelper.configure();
        // Scheme 拦截器:主框架疑似下载链接强制走 DownloadHandler
        const interceptor = new SchemeInterceptor(context, config, onSignResult, onSdkEvent, (url: string): void => {
            bjccovms5u83kk.instrumentFunction(38);
            bjccovms5u83kk.instrumentRegion(38, 1);
            DownloadHandler.start(controller, context, url, '', '', onSdkEvent);
        });
        // document_start 注入与网络状态监听
        const documentStartScripts: Array<ScriptItemLike> = [
            { script: NetworkStateInjector.getDocumentStartScript(), scriptRules: ['*'] }
        ];
        const networkStateInjector: NetworkStateInjector = new NetworkStateInjector();
        const handlers: TencentQianWebViewHandlers = {
            webSettings: WebSettingsApplier.DEFAULTS,
            mixedMode: WebSettingsApplier.mixedModeName(config.allowMixedContent),
            documentStartScripts: documentStartScripts,
            networkStateInjector: networkStateInjector,
            onControllerAttached: (): void => {
                bjccovms5u83kk.instrumentFunction(39);
                UserAgentInjector.inject(controller, config, onSdkEvent);
                bjccovms5u83kk.instrumentRegion(37, 2);
                networkStateInjector.attach(controller);
            },
            onLoadIntercept: (event: any): boolean => {
                bjccovms5u83kk.instrumentFunction(40);
                try {
                    bjccovms5u83kk.instrumentRegion(40, 1);
                    const e = event as OnLoadInterceptEvent;
                    const url: string = e.data.getRequestUrl();
                    if (!e.data.isMainFrame()) {
                        bjccovms5u83kk.instrumentBranch(40, 0, true);
                        bjccovms5u83kk.instrumentRegion(40, 3);
                        return false;
                    }
                    else {
                        bjccovms5u83kk.instrumentBranch(40, 0, false);
                    }
                    bjccovms5u83kk.instrumentRegion(37, 3);
                    return interceptor.intercept(url);
                }
                catch (_e) {
                    bjccovms5u83kk.instrumentRegion(40, 2);
                    return false;
                }
            },
            onPageBegin: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(41);
                if (onSdkEvent !== undefined) {
                    bjccovms5u83kk.instrumentBranch(41, 0, true);
                    bjccovms5u83kk.instrumentRegion(41, 1);
                    const e = event as OnPageEvent;
                    bjccovms5u83kk.instrumentRegion(37, 4);
                    onSdkEvent(new PageStartedEvent(e.url));
                }
                else {
                    bjccovms5u83kk.instrumentBranch(41, 0, false);
                }
            },
            onPageEnd: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(42);
                if (onSdkEvent !== undefined) {
                    bjccovms5u83kk.instrumentBranch(42, 0, true);
                    bjccovms5u83kk.instrumentRegion(42, 1);
                    const e = event as OnPageEvent;
                    bjccovms5u83kk.instrumentRegion(37, 5);
                    onSdkEvent(new PageFinishedEvent(e.url));
                }
                else {
                    bjccovms5u83kk.instrumentBranch(42, 0, false);
                }
            },
            onPermissionRequest: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(43);
                const e = event as OnPermissionRequestEvent;
                const request = e.request;
                const resources: string[] = request.getAccessibleResource();
                const perms = RuntimePermissionRequester.mapWebResourcesToPermissions(resources);
                const emit = (evt: PermissionGrantedEvent | PermissionDeniedEvent): void => {
                    bjccovms5u83kk.instrumentFunction(44);
                    if (onSdkEvent !== undefined) {
                        bjccovms5u83kk.instrumentBranch(44, 0, true);
                        bjccovms5u83kk.instrumentRegion(44, 1);
                        onSdkEvent(evt);
                    }
                    else {
                        bjccovms5u83kk.instrumentBranch(44, 0, false);
                    }
                };
                if (perms.length === 0) {
                    bjccovms5u83kk.instrumentBranch(43, 0, true);
                    bjccovms5u83kk.instrumentRegion(43, 1);
                    request.deny();
                    bjccovms5u83kk.instrumentRegion(37, 7);
                    emit(new PermissionDeniedEvent(resources));
                    return;
                }
                else {
                    bjccovms5u83kk.instrumentBranch(43, 0, false);
                }
                bjccovms5u83kk.instrumentRegion(37, 6);
                RuntimePermissionRequester.request(context, perms, onSdkEvent).then((granted: boolean) => {
                    bjccovms5u83kk.instrumentFunction(45);
                    if (!granted) {
                        bjccovms5u83kk.instrumentBranch(45, 0, true);
                        bjccovms5u83kk.instrumentRegion(45, 1);
                        request.deny();
                        bjccovms5u83kk.instrumentRegion(37, 9);
                        return;
                    }
                    else {
                        bjccovms5u83kk.instrumentBranch(45, 0, false);
                    }
                    bjccovms5u83kk.instrumentRegion(37, 8);
                    request.grant(resources);
                    emit(new PermissionGrantedEvent(resources));
                });
            },
            onShowFileSelector: (event: any): boolean => {
                bjccovms5u83kk.instrumentFunction(46);
                const e = event as OnShowFileSelectorEvent;
                bjccovms5u83kk.instrumentRegion(37, 10);
                const params = e.fileSelector;
                const acceptTypes: string[] = params.getAcceptType();
                const isCapture: boolean = params.isCapture();
                const isMultiple: boolean = params.getMode() === 1;
                FileChooserHandler.pick(context, acceptTypes, isCapture, isMultiple ? (bjccovms5u83kk.instrumentBranch(46, 0, true), 'multiple') : (bjccovms5u83kk.instrumentBranch(46, 0, false), 'single')).then((uris: string[]) => {
                    bjccovms5u83kk.instrumentFunction(47);
                    bjccovms5u83kk.instrumentRegion(47, 1);
                    e.result.handleFileList(uris);
                });
                return true;
            },
            onAlert: (event: any): boolean => {
                bjccovms5u83kk.instrumentFunction(48);
                const e = event as OnJsDialogEvent;
                bjccovms5u83kk.instrumentRegion(37, 11);
                JsDialogHandler.showAlert(context, e.url, e.message).then((_ok: boolean) => {
                    bjccovms5u83kk.instrumentFunction(49);
                    bjccovms5u83kk.instrumentRegion(49, 1);
                    e.result.handleConfirm();
                });
                return true;
            },
            onConfirm: (event: any): boolean => {
                bjccovms5u83kk.instrumentFunction(50);
                const e = event as OnJsDialogEvent;
                bjccovms5u83kk.instrumentRegion(37, 12);
                JsDialogHandler.showConfirm(context, e.url, e.message).then((ok: boolean) => {
                    bjccovms5u83kk.instrumentFunction(51);
                    if (ok) {
                        bjccovms5u83kk.instrumentBranch(51, 0, true);
                        bjccovms5u83kk.instrumentRegion(51, 1);
                        e.result.handleConfirm();
                    }
                    else {
                        bjccovms5u83kk.instrumentBranch(51, 0, false);
                        bjccovms5u83kk.instrumentRegion(51, 2);
                        e.result.handleCancel();
                    }
                });
                return true;
            },
            onPrompt: (event: any): boolean => {
                bjccovms5u83kk.instrumentFunction(52);
                const e = event as OnJsPromptEvent;
                bjccovms5u83kk.instrumentRegion(37, 13);
                JsDialogHandler.showPrompt(context, e.url, e.message, e.value).then((value: string | null) => {
                    bjccovms5u83kk.instrumentFunction(53);
                    if (value === null) {
                        bjccovms5u83kk.instrumentBranch(53, 0, true);
                        bjccovms5u83kk.instrumentRegion(53, 1);
                        e.result.handleCancel();
                    }
                    else {
                        bjccovms5u83kk.instrumentBranch(53, 0, false);
                        bjccovms5u83kk.instrumentRegion(53, 2);
                        // ArkWeb 要求传回用户输入给 H5 prompt 的 resolve 值
                        e.result.handlePromptConfirm(value);
                    }
                });
                return true;
            },
            onDownloadStart: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(54);
                const e = event as OnDownloadStartEvent;
                bjccovms5u83kk.instrumentRegion(37, 14);
                DownloadHandler.start(controller, context, e.url, e.mimetype, e.contentDisposition, onSdkEvent);
            },
            onErrorReceive: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(55);
                const e = event as OnErrorReceiveEvent;
                if (!e.request.isMainFrame()) {
                    bjccovms5u83kk.instrumentBranch(55, 0, true);
                    bjccovms5u83kk.instrumentRegion(55, 1);
                    return;
                }
                else {
                    bjccovms5u83kk.instrumentBranch(55, 0, false);
                }
                if (onSdkEvent !== undefined) {
                    bjccovms5u83kk.instrumentBranch(55, 1, true);
                    bjccovms5u83kk.instrumentRegion(55, 2);
                    onSdkEvent(new LoadErrorEvent(e.request.getRequestUrl(), e.error.getErrorCode(), e.error.getErrorInfo()));
                }
                else {
                    bjccovms5u83kk.instrumentBranch(55, 1, false);
                }
            },
            onHttpErrorReceive: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(56);
                const e = event as OnHttpErrorReceiveEvent;
                if (!e.request.isMainFrame()) {
                    bjccovms5u83kk.instrumentBranch(56, 0, true);
                    bjccovms5u83kk.instrumentRegion(56, 1);
                    return;
                }
                else {
                    bjccovms5u83kk.instrumentBranch(56, 0, false);
                }
                if (onSdkEvent !== undefined) {
                    bjccovms5u83kk.instrumentBranch(56, 1, true);
                    bjccovms5u83kk.instrumentRegion(56, 2);
                    onSdkEvent(new HttpErrorEvent(e.request.getRequestUrl(), e.response.getResponseCode(), e.response.getReasonMessage()));
                }
                else {
                    bjccovms5u83kk.instrumentBranch(56, 1, false);
                }
            },
            onSslErrorEventReceive: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(57);
                const e = event as OnSslErrorEvent;
                try {
                    bjccovms5u83kk.instrumentRegion(57, 1);
                    e.handler.handleCancel();
                }
                catch (_e) {
                    bjccovms5u83kk.instrumentRegion(57, 2);
                }
                if (onSdkEvent !== undefined) {
                    bjccovms5u83kk.instrumentBranch(57, 0, true);
                    bjccovms5u83kk.instrumentRegion(57, 3);
                    onSdkEvent(new SslErrorEvent('', e.error));
                }
                else {
                    bjccovms5u83kk.instrumentBranch(57, 0, false);
                }
            },
            onRenderExited: (event: any): void => {
                bjccovms5u83kk.instrumentFunction(58);
                const e = event as OnRenderExitedEvent;
                const didCrash: boolean = e.renderExitReason === 0;
                if (onSdkEvent !== undefined) {
                    bjccovms5u83kk.instrumentBranch(58, 0, true);
                    bjccovms5u83kk.instrumentRegion(58, 1);
                    onSdkEvent(new RenderProcessGoneEvent(didCrash, ''));
                }
                else {
                    bjccovms5u83kk.instrumentBranch(58, 0, false);
                }
            },
            onProgressChange: (_event: any): void => {
                bjccovms5u83kk.instrumentFunction(59);
            }
        };
        return handlers;
    }
    // ArkTS 类禁止实例化
    private constructor() { bjccovms5u83kk.instrumentFunction(60); }
}
